Tuesday, February 10, 2015

Add External Class File When You Run Java

To add external class file as input,

1. On the eclipse left pane, right click the project folder name
2. Click on Run As and then click on Run Configurations
3. On the left side, you will see your project folder name nest under Java Application
4. Click on your project folder name


5. Click on Arguments tab
6. In the text field under Program Arguments, add the class file location like this: /home/grad12/vpandey/javaprojects/hello.class
7. Click Run and You're Done! ;)


Note:
if you are using eclipse on windows, it may not work the file location for space or long directory like:
C:\Users\VK Pandey\Documents\javaprojects\eulerprograms\bin\eulerprograms\hello.class
or
C:/Users/VK Pandey/Documents/javaprojects/eulerprograms/bin/eulerprograms/hello.class

Try using like this:
D:/hello.class

2 comments: