I have a java project, which runs fine on eclipse. Right now, I need to run it from command prompt, like java classpath ... How to setup this classpath based on the stored ones using in Eclipse.

Recommended Answers

All 3 Replies

Read the JDK doc about how to use the java command.

Basically enter:
java CLASSFILENAME

where CLASSFILENAME is the name of the .class file.
If in a package there is more to it than that.

No idea how Eclipse works.

Briefly - make sure any non-standard dependencies (libraries) you may use have been placed somewhere (anywhere) in the classpath, then package the whole of your project's classes and resources into a jar (Eclipse: File -> Export -> Runnable jar file) which you can then run by java -jar myJarFile.jar, or by simply double-clicking it. Easy!

Set up a build file in ant. Put your dependencies in a directory and include them in the jar. Run the build file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.