Wednesday, June 6, 2018

Eclipse Basic Usage

Install Eclipse LUNA and define Workspace (D:\dScode\dCoreJavaPractice)




After completing java code, right click in code area & choose “Run As” & then “Java application”.
Code will get compiled & executed (if error free) and output can be seen in console window at bottom.

Right click Project name & select “export”, to create executable/JAR file (JavaARchive)

Select option “Runnable JAR file” from Java section and click “Next” button
Select proper Class name (having Main() method) in “Launch configuration”  and browse desired Export destination with JAR file name and Click “Finish” finally.





We can execute JAR file on command prompt (where JAR file located) using below command:
                D:\>java -jar <jar file name>
                D:\>java -jar HelloJavaProject.jar

D:\>jar xf HelloJavaProject.jar                            extract jar file
D:\>jar tf HelloJavaProject.jar                            view contents inside jar file









Keep all required jar files in a Workspace folder (D:\DBChavan\dJavaWorkspace\Jars)
and add those jar files externally in project.
Right click project name on select “Properties” i.e. Project Properties.
In project properties “Java Build Path” and in tab “Libraries” click button “Add external JARs...”
and browse jar files kept in workspace folder.
In project explorer external jar files will be seen as “Referenced Libraries”





No comments:

Post a Comment