Getting compile errors on Eclipse from Bean shell files - java

What is the correct way to import Java bean shell files into Eclipse? I want to use eval so I copied the files from an app that my friend paid for but he did not get the source files. Anyway, when I did that, I got so many errors like 'syntax error on token interface', 'implicit super constructor undefined', 'constructor call must be the first statement in a constructor', and a bunch of other errors. Any help you give is appreciated.

Related

Javadoc warning - bad source file: file does not contain class com.example.MyClass

I have a file called MyFile.java and it contains multiple classes(none of them is public). Note that the file does not contain MyFile class. Apparently Javadoc is not happy about this and it generates a warning saying file does not contain class com.example.MyClass. A few solutions I looked into:
Move classes into their own files. This looks like the proper way of fixing the warnings, but the new files won't obliviously have the source control history, so I am trying to avoid it.
Create empty MyFile class. This is ugly.
Hide Javadoc warnings, preferably per file. There is a high chance that this is not possible.
A few questions that I have:
Why does Javadoc complain? I couldn't find any documentation, please point me to one. I think it is perfectly fine not to have a class with the same name as the file.
Any other suggestions I can look into?
Is it possible to hide warnings somehow? additionalparam="-Xdoclint:none" does not work.
Thank you all in advance
When building with maven from the command line, I encountered this error from maven-javadoc-plugin.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.2.0:jar (default) on project code-mapping-database: MavenReportException: Error while generating Javadoc:
... error: cannot access DataSourceWrapper
Eclipse IDE reported a similar error.
This occurred after I had copied DataSourceWrapper.java to another (dependent) project and commented out all lines of DataSourceWrapper.java in the original project. After deleting the commented out version, the error went away. The effectively empty DataSourceWrapper.java file must have caused maven-javadoc-plugin to stop looking for class DataSourceWrapper.

Creating Java Packages in IntelliJ

I've been using Eclipse for a while and I'm having trouble understanding what's going on with my first project in IntelliJ. I've read the documentation, and searched other questions, but I still can't seem to grasp it. I think there is something wrong with my project structure. This is what my structure currently looks like;
I'm trying to run the JavaForLoop class, but whenever I do, compilation fails because I have errors in the StringMethods class of the strings package. My question is why would that prevent compilation if the two classes are in separate packages? Neither class uses the other, and they both have the appropriate package declaration statements. With a similar structure in Eclipse, this would work. Should I be using a different project structure?
By default IDEA adds Build Configuration which is executed before launch and includes following steps (taken from here):
Compiling source code in the source path of a module and placing results to the output path.
Compiling source code in the test path of a module and placing results to the test output path.
Creating copies of the resource files in the output path.
Reporting problems in the Messages tool window.
check if it's your case in Edit Configuration screen and if so, remove it.
To use a class from a different package you must declare a import statement to the class.
In your JavaForLoop.java add the import before the class statement (and after package declaration where its the case)
//package ...
import strings.StringMethods;
//public class JavaForLoop { and the rest of the code
Intellij uses regular javac, which will fail to compile if you have errors anywhere in the code.
Eclipse has it's own compiler, that allows to compile and even run code that has compilation errors, causing a runtime exception if any part of the code that has errors is run. This allows you to run parts of the code that work even if other pieces of code are failing.
The simple solution is to resolve your compilation errors. You can also use the eclipse compiler with Intellij, but I've never done this so I can't comment on how well it works.

Error SevenZipJBinding in dynamic web project

I'm using sevenZipJBinding to uncompress a .tar file in dynamic web project i put their jar in my project and when I run it i get this error:
java.lang.NoClassDefFoundError: net/sf/sevenzipjbinding/IInStream
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:111)
What does it mean ?
And how to fix it ?
This means that the method invoke in the class com.sun.faces.facelets.el.TagMethodExpression uses the class or interface net.sf.sevenzipjbinding.IInStream at line 111 of the source file it was compiled from (TagMethodExpression.java), but the classloader is unable to find that class now (it's probably missing), even though it was probably present at compile time (unless someone edited the bytecode manually).
I'm not sure if that's what you wanted to know, but it definitely is what you asked for.

NetBeans 7.0 build output errors not hyperlinked

NetBeans docs at http://docs.oracle.com/javase/tutorial/getStarted/cupojava/netbeans.html say:
If the build output concludes with the statement BUILD FAILED, you probably have a syntax error in your code. Errors are reported in the Output window as hyper-linked text. You double-click such a hyper-link to navigate to the source of an error. You can then fix the error and once again choose Run | Build Main Project.
However, in NetBeans 7.0.1, the hyperlinks are mostly missing. (I'm running in Linux Mint 12.) The errors are plain text and navigating to them is a pain. This is true for all errors except for two at the end which are hyperlinked. The two that are hyperlinked are of no immediate use to me. They are:
/home/user/Workspaces/MyApp/client.git/nbproject/build-impl.xml:603: The following error occurred while executing this line:
/home/user/Workspaces/MyApp/client.git/nbproject/build-impl.xml:284: Compile failed; see the compiler error output for details.
All the places I need to edit in the code are mentioned by file and line number, but are not hyperlinked:
MyApp.java:40: cannot find symbol
symbol : constructor MainView(com.example.desktopclient.MyApp)
location: class com.example.desktopclient.MainView
MainView mainView = new MainView(this);
Does anyone know anything about this issue. I searched but didn't find anything relevant.
EDIT: I'm NOT looking for help with the code errors! I want to find out why NetBeans isn't working correctly.

Eclipse 3.5 is generating a "method not applicable for the arguments" error for no reason at all

The error is this:
The method add(String, int) in the type DataNode is not applicable for the arguments (String, String)
However, in the DataNode class, I have a number of overloaded add() methods, including one that takes a String and an int and one that takes two Strings. It appears that Eclipse isn't "seeing" the right add() method.
I've tried things like refreshing the project and files and removing the method, saving the file, then adding it back. No matter what I've tried, the error persists.
Does anyone know the cause and how to correct it?
Try to clean to project direcly
Project-Clean
I my case this is working... most of the time.
Forcing a compile with my Ant build script, some errors were revealed. When I refactored my package names, import statements were added to some files that imported nonexistent files (or at least what should have been nonexistent files, I need to check on that). For some reason, this generated the error that I was seeing. Removing the import statements corrected the problem.

Categories

Resources