i downloaded watij and am trying to get it to run in eclipse. i tried this sample code
WebSpec spec = new WebSpec().safari();
spec.safari().open("http://www.google.com");
and WebSpec is underlined in red saying WebSpec cannot be resolved into a type
I assume this means that something has not been added into my project.
I right clicked on my src folder and added the .jar files and then added webspec.jar to the project also
Are there any steps that I am missing?
You don't put JAR files in your src folder. They are not source files.
Create a lib folder, put the JAR files there, and then add them to the project's build path.
Related
In my Java project I have a folder like the one below, where I put inside some icons that I'm going to use with JTree library.
When I run the Jar outside Eclipse, I cannot see my icons.
If I open my Jar with archive utility, I cannot see the folder inside it. I also tried to add different folders and they are never referenced inside the final Jar.
So, is there a way to reference the folders in the Jar file?
You need to ensure that Eclipse knows that while building the Jar it has to include the newFolder inside the Jar. You can do that in Eclipse by following the below step in :
click project -> properties -> Build Path -> Source -> Add Folder and select the new folder you just created.
Now create you Jar and you will see your folder in the Jar.
Either move the folder (myFolder) into src directory or mark it as a source folder.
I downloaded and decompiled a jar file for a plugin for minecraft, and I added it to eclipse by creating a new java project, Import > archive file > [decompiled jar.zip]
That results in this:
After that, I changed a single line of code, then I tryed to export it.
However, when I attempt to export it, I get this message:
I have no idea what I'm supposed to do to fix this. Please help.
de (and not only its content) and the other folders as well must be included in the source folder.
Try to move all the folders (except META-INF) and files to src and then create your jar.
(Note that there would be a warning if you didn't exclude META-INF because it is generated you would override it but it wouldn't prevent generating the jar).
NOTE
I don't know what you will do later with this but you'd better use Maven, Gradle (or even Ant) to manage you future jar builds.
I added the boilerpipe library directly to my src folder. Everything seems to be compiling when I run, but I get an error telling me that one of the classes in the boilerpipe library could not be resolved.
The ArticleExtractor class is what I'm trying to use, but Eclipse won't let me even though its class file is in the bin folder.
I'd post a picture, but I don't have the reputation. Boilerpipe itself is a folder containing several other folders, containing the .java files in the source folder, and .class files in the bin folder after I've tried to run. I couldn't find anything on this here so I though I'd ask.
without seeing the code I would say that you either haven't added it to the build path or haven't imported the code into your class.
Well I have these .java files in JCreator.
When I compile them in JCreator, it's fine, all files and folders are read and no errors occurred. But, I need to compile them in an Eclipse project to pass it to my professor. Then the problems started.
I added the .java files in a new Eclipse project and into a new package inside the
src folder
Then after that, I made a new Folder in the project called
res
and added it to the build path as a source Folder and added the files and folders in it.
>Use as Source Folder
All sub-folders are fine same name and stuff, Refreshed the project a few times, checked the build path, but when I execute the program, It says:
java.io.FileNotFoundException: sounds\bgmusic.wav (The system cannot find the path specified)
from this line:
InputStream test = new FileInputStream("sounds\bgmusic.wav");
Same folder name, same file, added it to the Build Path and stuff. Also, I repeat, It does not find ALL the files in the resource folder: Pictures, Sounds Fonts and other stuff. I already made some projects in Eclipse and I had successfully added pictures and sounds in them. But what's the problem with this?
Thanks for the help!
Try this:
ClassLoader.getResourceAsStream ("sounds\bgmusic.wav");
I hope it resolves your issue.
You can also refer below link:
http://www.javaworld.com/article/2077352/java-se/smartly-load-your-properties.html
When I try to make an executable jar in netbeans I get this error
C:\lwjgl\lwjgl-2.8.5\res is a directory or can't be read. Not copying the libraries. Not copying the libraries.The res folder holds files like jpgs and wavs that the program relies on to function. I'm using lwjgl, would that be part of the problem? What could be causing this?
try this
Right click on your project folder and click on >>>>clean and
build<<<<
right click on your project folder click on >>>Properties<<<< you
should see the location of your project folder normally this should
be in your documents folder under NetbeansProject folder. locate
your project name folder inside is a folder called >>>dist<<< in
there you should find your project name with a small java cafe
image which is your jar file.