today, I've tried to run my ImageJ plugin My_S but ImageJ always gives off the following Warning:
Plugin or class not found: "My_S"
(java.lang.ClassNotFoundException: My_S)
I think that it kind of skips the compiling step, because there is no My_S.class file in the plugin folder.
This is a little weird, because it worked before (I tried it for one plugin only though).
Then I tried to compile it from the console with
javac My_S.java
which gives off the following qarning:
My_S.java:1: package ij does not exist
import ij.*;
^
So, I tried to re-install it (my system is linux mint btw) but IJ still shows off the same behavior.... : /
Are there any suggestions on how to solve this problem? (I hope this is the right place to ask this question)
Thanks
The "ij package" (that is, all classes in ij.*) is found in the ij jar, e.g. ij-1.50e.jar distributed with your ImageJ installation.
To compile your plugin with javac, see this SO post about adding jars to the classpath.
However, if you are going to be developing ImageJ plugins regularly I encourage you to learn about the software development tools available, like Maven, which will help you manage dependencies and build your compile-time classpath automatically (among other things).
You may also be interested in the ImageJ forum, which reaches a more targeted community for ImageJ-specific development issues.
Related
I am trying to install JavaFX and in particular just run this application. I've been using Java for a while and I have to compile from console since IntelliJ just won't load in my laptop. Whenever I try compiling with "javac HelloFX.java" I get a lot of errors and in particular error: package javafx.application does not exist. This is what my java folder looks like
Java Folder
I also already set up a path C:\Program Files\Java\javafx-sdk-18.0.1\lib
I really have no clue as to what I am doing wrong, and the solutions I've been able to find seem rather complex, or use IntelliJ tools. Thank you in advance.
Even if IntelliJ does not work for you, you could still use either Maven or Gradle to build your project which would already simplify things a lot. You should also have a look at the official documentation.
https://openjfx.io/openjfx-docs/
Specs: Linux Mint 18.3, Eclipse 2019-06, Groovy 2.5.8, Java 11
I started a Groovy project, and created a package "test" under the "source folder". Under test I put a file, "test.groovy". This file looks like this:
package test
It's got a horrid white-cross-in-a-red-box. The error message is:
Multiple markers at this line:
- The type groovy.lang.MetaClass cannot be resolved. It is indirectly referenced from required .class files
- The type groovy.lang.GroovyObject cannot be resolved. It is indirectly referenced from required .class files
I have tried multiple strategies: restarting Eclipse, cleaning the project, removing and putting back the JRM for the project. Nothing doing.
There are a few cases of this error when I Google, but mostly they appear to be from years and years ago, on an active bug list, so I presume resolved.
Any ideas what's going wrong?
NB according to my notes, I have had this problem before a couple of times with Gradle projects, and the problem was resolved by going Gradle --> Refresh for the project. But this is a (pure) Groovy project, not Gradle, and the "Refresh" option is not available.
By the way, when I look at this problem in the "Problems" the error type is said to be "Java Problem".
later
It's been suggested that the cause might be Java 11. This is an interesting idea. However, Groovy 2.5.x in itself is not incompatible with Java 11. Firstly, I have no problem running this at the CLI, and no problem with Eclipse-based Gradle projects configured with Java 11 and Groovy 2.5.x, using Groovy as the language of the app and testing files. Crucially, of course, the Gradle wrapper chooses its own Groovy version, and in such circs the user chooses their own Groovy version for their executables as a dependency in build.gradle. So Eclipse Groovy-handling is mercifully "bypassed".
I am thus beginning to suspect that the Groovy-Eclipse add-in may be the culprit. Amazingly enough, and I was surprised by this, I downloaded and set up the 2019-12 Eclipse package, completely separately, and tried to create a Groovy project in it. Even after several attempts to install both the "release" and "snapshot" versions of Groovy-Eclipse for this version of Eclipse (i.e. here), I cannot start the simplest of Groovy projects in that IDE.
So my suspicions are circling around this theory that Groovy-Eclipse is unable to work properly with Java 11. Only problem is that you might expect to find such a bug as one of the issues, but there is nothing.
Add "requires org.codehaus.groovy;" to your module-info.java
I am new in Scala, so sorry if the question is absolutely obvious.
I have an Eclipse Photon installed on my computer. Would like to edit Scala code and produce runnable jars. The tricky part is that I don't have internet access on my computer (Centos7).
I bear in mind two potential issues/questions:
Downloading the plugin manually: I know, that Scala IDE plugin for Eclipse enables running Scala code/producing jars (like https://medium.com/devilsadvocatediwakar/how-to-install-scala-plugins-in-eclipse-in-ubuntu-13e53ffe3f39). Installing it from the GUI is rather straight forward. Is it possible to download a plugin bundle manually (not from GUI), move it to target computer and finally install it?
Compiling code into jars: assume that the point 1 is done. SBT or Maven requires some dependencies (e.g. Yoda time, Spark libraries) to produce specific jars - does it cause, that all the dependencies shall be moved and installed manually also?
The answer was provided by the Luis Miguel Mejía Suárez in comments:
Yes you can. For installing a manual plugin - here you can find the
zip of the ScalaIDE - and finally, use the maven repository to search
and download the dependencies JARS... However, is this really your
personal computer? or some kind of deployment server? - Also, as an
ex-user of the ScalaIDE I would recommend you to try a different,
newer IDE. For example, I just switched the last week from Eclipse to
VSCode with metals.
I am trying to get our build machine to consistently build our Blackberry project (build using the Eclipse plugin not the JDE) on check-in. We are using Jenkins to call the project and sometimes it works but only after I've fired up the project in eclipse on the far machine but then restarting causes the error to come back.
The first error I get is (the following errors are all in the same vein):
[javac] c:\<path_to_project>\src\path\to\package\class.java:6: error: package net.rim.device.api.ui does not exist
And every other reference to a net.rim.* object. Clearly it's because it's not linking to the target net_rim_api.jar file but I can't figure out what on earth is going wrong. I've tried poking at the build.xml file but I just get more errors and other versions of this error in other threads turn out to be not the same thing.
I have tried installing and using BB-Ant (roughly following this tutorial) but it has not provided me with the solution - I'm prepared to admit that I may have made a mistake in the implementation but I followed it as closely as I could with the current project that I have.
I would appreciate any help that you can give me.
EDIT
So I've now altered the project to use <rapc> instead of <javac> which appears to do the linking to the .jar for you but it's still frustrating that you can't simply use the auto generated build.xml. Is this a known (and due to lack of information available on the internet, accepted) issue with Eclipse?
I went down the BB Ant build script road a year or so ago, got a lot of help on this site, and tried to document my progress on this site. Hopefully the links I place will help you and others.
I have marked this as "community wiki" since it doesn't directly answer the question but I do think it is useful.
Basic algorithm
My answer on this page shows the algorithm for a working build script (BlackBerry: create COD from JAR source file in Ant script). Perhaps this is more complicated than you are looking for, but it does show the relationship I found between javac and rapc.
To summarise, I wanted to include my SDK into the final build, and the steps were:
javac the SDK to create CLASS files
preverify the CLASS files
jar the SDK
Copy the SDK JAR file into the project
javac the project - use the SDK JAR as the classpath
preverify the project CLASS files (again, use the SDK JAR in the
classpath)
jar the project - add the SDK JAR as a zipfileset
jarjar this project JAR to refactor package names as required
Finally, run rapc on this JAR - it will find no duplicate COD files
& should run fine.
Please read the other answers on that page, since they offer great advice that I used in my end result.
Extra Info & Including a JAR into final output
I'd recommend this page just for the extra links that I included in it - the exact question is unrelated (BlackBerry - Ant script to include JAR in project without external dependancies).
Again, the value is in the answers that the other guys provided.
Misc
Here are a couple of links to other BB build script issues that I had - you or someone may find them useful:
BlackBerry - Ant build script for more complex apps
BlackBerry - final step of build process
Finally this one speaks to a mistake in the documentation when compiling your own code into a library for import into a different project:
BlackBerry - use own JAR file in own project
Hi i've been trying to install the library on Thinking in Java book 4th edition and i hit a very thick brick wall. I've done everything that the guide from the website told me to do and i still can't get the library to work. From what i've read it seems that the problem is from the build.xml files. having no xml knowledge I am clueless about how I have to modify it in order for it to work. In both cmd and eclipse I am getting these error
c:\TIJ4\code\build.xml
Build Failed
c:\TIJ4\code\build.xml:59:J2SE5 required
Can anyone tell me what I should do ?
I am using eclipse if there is a simpler solution by using eclipse rather than ant please help me out. It's been a week now and I still can't make it work.
The important thing to do is to realize that your ant file has a specific java requirement.
Something to try that might fix this very easily : I believe you can remove any references to a specific JDK, and if you have a reasonably up to date JDK, the build will succeed.
The definete fix : Look into the exact (line 59) of your build file, and try to satisfy the java version that line requires. Java is generally backwords compatible -- something designed to run in J2SE5 should run in the latest JDK. Its not terribly difficult to update your JDK (just google for instructions on your OS).
The most common mistake I see is that people who have the java run time installed believe they also have the Java SDK as well.
Does this "install the library" means you want to look at the code and run them in your eclipse? If so I can share my experience with you.
First run the Eclipse.py script; this will add package info to the source code
Create a new Java project in Eclipse, and then just copy all the source code folders to the src source folder in eclipse, these folders will then be recognized as Java packages.
You should be able to run the classes with a main function.
You can also configure which java version to use for this project in Eclipse build path. 1.5 or higher will work.