1

I made my project in Netbeans but my professor said it must be able to compile it with command line. So tried everything i still get errors like : org.jdesktop.application package does not exist?

Please help me how to feed the line in the command prompt.

1
  • In distinction to the other answers, I would clarify with the professor if non-J2SE classes are permitted in the solution. I suspect not. Commented Dec 29, 2010 at 14:26

3 Answers 3

2

You need app-framework.jar in your classpath, which is there in classpath if you run it from NB.

Sign up to request clarification or add additional context in comments.

4 Comments

I added it. But I still get error. I added javac -cp /lib/app-framework-1.0.3.jar ATMMain.java But I still get errors. :S
try ./lib/app-framework-1.0.3.jar (notice the dot in the beginning)
Check the path. it seems wrong, try giving full path like./home/username/../appframework.jar
ATM\ATM\dist>java -cp c:\appframework-1.03.jar -jar ATM.jar Note I am using win machine for now and app-framework resides in c:\ currently for me , It works for me
1

Use -classpath key of javac to include the appropriate jar.

C:\...\ATM\ATM\src\atm>javac
ATMApp.java ATMView.java CheckIDandPIN.java AccountDetailsServices.java -cp appf
ramework-1.03.jar

This works if the appframework.jar is located in one folder with ATMApp.java

C:\...\ATM\ATM\src>java -classpath .;appframework-1.03.jar atm.ATMApp

This launches your application if you copy the jar to src folder.

6 Comments

It compiles it. Hahaha. Thank you. But When I run java ATMApp.class or without .class it gives exception that class is not found. Gosh!
because you should run it from ATM\src.
But the class files are now in the same folder with the source files in \src
Java searches for the class file using the folder structure which reflects the package structure. learn a bit more java please.
see update. And give at least one upvote to org.life.java as he really helps you.
|
0

sounds like a misunderstanding. By default, Netbeans uses ant to build projects. Ant is a CLI build tool. So, most any Netbeans project will easily compile and build as a JAR from the CLI. Simply run ant -p build.xml from in the project directory. You should see options to build. As far as I can recall, ant jar will build and distribute most any SE project out of the box.

That's building from the CLI.

Probably the instructions were (back in 2010) to use javac directly.

As Jigar said, you have a classpath problem. Your classpath problem is unrelated to building the JAR from the Netbeans GUI or from the CLI.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.