Nikola Despotoski
Nikola Despotoski

Reputation: 50538

Compile in command line java desktop app written in NetBeans with netbeans gui editor?

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.

Upvotes: 1

Views: 1012

Answers (3)

Thufir
Thufir

Reputation: 8487

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.

Upvotes: 0

Vladimir Ivanov
Vladimir Ivanov

Reputation: 43088

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.

Upvotes: 1

Jigar Joshi
Jigar Joshi

Reputation: 240860

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

Upvotes: 2

Related Questions