LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Unable to access jarfile spl.jar (https://www.linuxquestions.org/questions/linux-newbie-8/unable-to-access-jarfile-spl-jar-4175472003/)

stevorobs3 08-03-2013 01:49 PM

Unable to access jarfile spl.jar
 
Hi,

I am new to both Linux and programming and am trying to follow the stanford course - CS106B. I have managed to install an IDE (netbeans, the C++ version) and am trying to run a program. The program builds fine but when I run it, I get the message "Unable to access jarfile spl.jar".

Netbeans has build the file into an executable (application/x-executable) called cs106b and somewhere underneath this is the spl.jar file which it cannot access.

I have also tried the same thing using the eclipse environment, tried running the executable file from the terminal (even using sudo) and changed the permissions of the file in question but still get the same error.

Could someone advise as to what I'm doing wrong?

Thanks in advance!

jailbait 08-03-2013 02:41 PM

The first thing to do is to find out where spl.jar is and if it exists then examine its permissions. You can find spl.jar with this command:

find / -iname "*spl.jar*"

This find command will search your entire filesystem and could take a while.

-----------------------
Steve Stites

stevorobs3 08-04-2013 04:36 AM

Quote:

Originally Posted by jailbait (Post 5002344)
The first thing to do is to find out where spl.jar is and if it exists then examine its permissions. You can find spl.jar with this command:

find / -iname "*spl.jar*"

This find command will search your entire filesystem and could take a while.

-----------------------
Steve Stites


Thanks for your reply. I did that search and the file exists in 2 locations:

/home/stevorobs3/NetBeansProjects/Assignment1-linux/0-Warmup/spl.jar
/home/stevorobs3/NetBeansProjects/Assignment1-linux/0-Warmup/StanfordCPPLib/spl.jar

I had already changed the file permissions of these to:

-rwxrwxrwx 1 stevorobs3 stevorobs3 412533 Jan 9 2013 spl.jar

I was wondering, could it be that I am not adding the .jar library correctly into my netBeans project?

Thanks for your help,

Steve

larrykeenan 08-04-2013 06:22 AM

Hi I am new to JAVA myself but was forced to learn
some of about a week ago as I needed to make a program
for those that don't own Adobe Acrobat to inject flash
auto-responder forms into their pdfs.

In both netbeans and eclipse, Your libraries need to be in two places.
When netbeans compiles, by default all external libraries are put in a
separate lib folder. eclipse compiles all to the one jar file.

The two places by default are project/lib/ and project/dist/lib/
That would probably be :
/home/stevorobs3/NetBeansProjects/Assignment1-linux/0-Warmup/lib/
/home/stevorobs3/NetBeansProjects/Assignment1-linux/0-Warmup/dist/lib/

I am going to give you another simple thing you will come across with
eclipse. Imagine you put some images in your project instead of text.
We are adding file.gif to a button. In eclipse we create a new source
folder using the file new menu and import file.gif to that folder.

You also have to copy it to root of your project bin folder.

When you use it don't mention the source folder because when compiled
it will be placed in the root of the jar along with your other jar files.
eg.
Code:

createImageIcon("/file.gif"));
Sorry for the long reply but it drove me batty for a couple of hours.

Have a great day!
Larry Keenan

stevorobs3 08-04-2013 08:44 AM

Quote:

Originally Posted by larrykeenan (Post 5002573)
The two places by default are project/lib/ and project/dist/lib/
That would probably be :
/home/stevorobs3/NetBeansProjects/Assignment1-linux/0-Warmup/lib/
/home/stevorobs3/NetBeansProjects/Assignment1-linux/0-Warmup/dist/lib/



Larry Keenan

Hi Larry,

Thanks for your reply, unfortunately I still get the same result. I made sure that a copy of spl.jar was in the above to folders you mentioned but I still get the same error. Is that what I should have done?

Thanks,

Steve

larrykeenan 08-04-2013 09:42 AM

I know exactly what you have done wrong now.

In netbeans just drag and drop one assignment folder to start your project.
In this case the 0-Warmup folder Not all of them.

I visited http://www.stanford.edu/class/cs106b/ to check directory layout
Have a Great Day!
Larry Keenan


All times are GMT -5. The time now is 07:17 PM.