I have a java webapp (servlet), running in Tomcat; and a related external .jar library. Everything was fine, and suddenly, symbols (method names) can't be found. Even though I can run the app in netbeans, I can't build the app for deployment to the server: Build Failed; a series of Cannot Find Symbol errors related to an external .jar file, added as "library" in NetBeans. The library had been working fine and had not been changed:
.../src/java/com/shelterislandsoftware/alphascreen/screen/FeatureNumber.java:842:
error: cannot find symbol
this.formatType = SisFormat.valueOf(in.readUTF());
symbol: method valueOf(String)
location: class SisFormat
.../src/java/com/shelterislandsoftware/alphascreen/screen/FeatureNumber.java:911:
error: cannot find symbol
out.writeUTF(formatType.name());
symbol: method name()
location: variable formatType of type SisFormat
The source files of the SisFormat.java classes sit in the correct src folders they've always been in; the methods are present in the class and written correctly. Any suggestions? Thanks.
-- UPDATE: Now, I'm also unable to (re-)build an old JavaFx project. The java code has been built and working as an osx application; I wanted to change the icns image, and I can't rebuild. I doubt that the new image is the source of the build problem, just as I doubt that my (perfectly functional) java servlet code is the source of my build problem described above. I don't know for sure but I really suspect there's a problem with the new NetBeans 8.2 and / or osx Mojave. No one's interested, OK then. I've just copy-pasted the (formerly) library source classes directly into the main project described above, and this lets me build. It's suboptimal, as I'm using the same .jar file in a separate web app, so now I have two copies of the same classes to maintain. Oh, also, the same .jar that is unbuildable as an external jar now in this web app described above, is still perfectly buildable as an external jar in the other web app. Whatever.
I fixed this problem. The new osx (Mojave) and the newest Netbeans as of writing (8.2) are intolerant of certain package names. I fixed the problem by altering my package names. Specifically, I had projects (in their own project directory) and a library (in its own library directory). While these directories were distinct in the computer's file system, the subsegment of those paths that Netbeans considers to be the "package name" had a common root element. Both the project(s) and the library "package name" started out like com.mydomain followed by the specific name of the project or library. I fixed the problem by changing the library package name to "lib.mydomain", and all the funky build problems ceased.
Related
So I have a java project (P1) (I am using Play Framework) in which I import a jar file (I generated from a different project I have (P2) ).
I had to do few changes in project (P2) including renaming few variables. Then I regenerated the Jar file which I then imported in (P1)
However whenever I try to run my project I get the follwoing error message
cannot find symbol
Read from stdout: symbol: variable FIELD_NONSTEMMED_CONTENT
However the IDE is not showing any errors. In fact when I click on the variable FIELD_NONSTEMMED_CONTENT it redirects me to the imported class (from the JAR) which already have this variable.
So I am not sure what could be the cause of this issue.
I have read the detailed answer of the background on this error (see below), however I could not find related infromation.
https://stackoverflow.com/a/25706217/1831518
EDIT
To clarify
My IDE is intelliJ
My project (P1) is java web application built using playframework. I use Lightbend Activator build and run the project
The error message (shown above) appears when I try to build the project (P1)
Project (P2) - used to build the JAR file - is a normal java project
I am trying to integrate my application with stardog. The application accesses already other RDF repositories in Java via sesame remoteRepository interface.
Stardog writes in http://docs.stardog.com/#_using_sesame that this can be achieved via a use of StardogRepository() - but without saying what libs to include.
After a little search inside the stardog 4.1.3 installation I found and included in eclipse's WEB-INF/lib:
stardog-api-4.1.3.jar
stardog-sesame-core-4.1.3.jar
After that, the eclipse Java compiler shows no errors in the code but one error in the project path, saying:
The project was not built since its build path is incomplete. Cannot
find the class file for
org.openrdf.repository.base.AbstractRepository. Fix the build path
then try building this project
After project cleaning this problem remains.
This class org.openrdf.repository.base.AbstractRepository is defined in the lib eclipse-rdf4j-2.0.1.jar, which is also present in the WEB-INF/lib folder (with or without this latter eclipse-rdf4j-2.0.1.jar the problem is unchanged).
What lib shell I include in order to have these 2 lines of code in http://docs.stardog.com/# compiled?
Thanks a lot in advance for any hint.
The solution is: include openrdf-sesame-4.1.2-onejar.jar and the stardog code will compile.
Im want to link an android jar library to my Xamarin project, i do everything covered by the online doc on Xamarin website.
But when i compile the binding project i got a warning that say : No Package Found.
If i replace the desired Jar by another, let say picasso.jar for example, i don't have this error and the binding projet compile without problems.
I can't link the jar library because of an NDA engagement.
But it's possible that the problems is that i get the .jar from a repository supposed to be build by maven/gradle and not a final .jar compiled?
What can i do to track the real error behind this "no package found"
A DLL is correctly generated at the end of the process, but added it to the main project don't give me any classes from the original jar.
As I thought this is the fault to the jar from maven repository. Inside the jar we got java files and not compiled files.
So i take an compiled jar (aar files) and everything work now.
I'm using Eclipse to debug a Java program I'm developing. Upon stepping into an insert method of one of my classes called from another class I get a source not found error. I have no idea why because when I hit F3 to go to the class' definition it does so without a problem. I'm using Eclipse Kepler
The class in question is found in a jar file on your classpath and jar files do not correspond to editable source. (but it may have a read-only source zip file attached).
This is most likely because the jar file is placed before the project containing the class on the launchers build path.
Fix your build path.
I am running into problems when I try to run the jar file created in IntelliJ.
I followed the steps laid out here: How to build jars from IntelliJ properly? and searched far and wide for other people with the same problem using IntelliJ, and found no solution.
In the menu Project Structure>Artifacts section I have the package and main class name, and I have also tried specifying the 'Class path' bit using a relative and absolute path both to the source file and the .class file (which seems hidden in the IntelliJ Project display tree..), but even with all this (I also make sure to rebuild the jar every time I change something) I get the "Cannot find the main class. Program will exit." message when I try to run the jar.
In the main project folder, there is src and out.
out contains 'production' with the package tree and the class files
out also contains 'artifacts' with the jar folder and jar executable
src contains a folder of images, the META-INF and the package tree.
the first folder in the package contains the main class, so src/ravelDemo/RavelDemoMain.java
in Project Settings>Artifacts, the main class is listed as ravelDemo.RavelDemoMain
currently, the class path is out\production\RavelSequence v1.03\ravelDemo\ but this and every other class path I've specified (or left blank) doesn't seem to point to the right place. (RavelSequence v1.03 is the name of the project).
What am I doing wrong?
Basing on the discussion is the comments above it appears that IntelliJ IDEA is building the valid executable jar with the main class correctly specified in the Manifest, this jar works fine when executed with java -jar ... command from the command line using the project target JDK version on the user's machine.
The problem is that it doesn't work on double click on #sideways8 system. It may be caused by the corrupted default Java installation or wrong .jar file type association in Windows registry. This is machine specific issue as I have no problem running the shared project jar on my system by double clicking on it.
To fix this problem you can try to uninstall all the Java versions present on this machine from the Control Panel | Programs and Features, then install new JDK from scratch so that it's the only JDK on the system and .jar file type is handled by it.
I use Total Commander which has a nice feature to check/edit file associations (File | Associate With...), here is how the .jar association is displayed when I press Edit type...:
I had the same problem. Either the jar file was created with IntelliJ IDEA or other IDE. I found out the problem in my case that I had two version of java installed on my computer (java 6 & java 8).
It's a problem of misconfiguration of the system. so remove any version of java you have and install it again and the problem is solved.