I am using ImageJ in java code for doing segmentation of objects in images using LevelSet.
I imported the jar file called "levelsets.ij.LevelSet". But I get an error as 'unidentified command' in the string field 'Level Sets' in the run command.
Can someone help me to identify the error in my program?
When executing the following code the string parameter "Level Sets" in line 3 is not identified as a command. Can you kindly help?
ImagePlus imp = new ImagePlus("image_plus", img);
imp.setRoi(new OvalRoi(54,51,11,7));
IJ.run(imp,"Level Sets", "method=[Active Contours] use_level_sets
grey_value_threshold=50 distance_threshold=0.50 advection=2.20
propagation=1 curvature=1 grayscale=20 convergence=0.0050
region=outside");
img = imp.getBufferedImage();
Manage your project dependencies using Maven. Add a dependency on the sc.fiji:level_sets artifact.
I identified this artifact by pressing L to bring up the Command Finder, typing in "level" and then looking at the File column to see which JAR file the levelsets.ij.LevelSet class came from.
See also the Development page of the ImageJ wiki.
Related
I've created a "*.jar" file with Intellij IDEA and added to IBM Notes Domino 9 with Code -- Jars -- Import Jar.
I can see my packages in classes which stored in "Code -- Java") but i have an error when i try to use my jar in xpages code:
I have a simple code on my test xpage:
importPackage(com.ibm.ibateam.sources);
var area = new Area("first");
getComponent("label1").setValue(area.getUnid());
but this code throws exception:
Script interpreter error, line=2, col=16: [ReferenceError] 'Area' not found
1: importPackage(com.ibm.ibateam.sources);
-> 2: var area = new Area("first");
3: getComponent("label1").setValue(area.getUnid());
I've tried everything with Java Build Path but nothing works.
I also tried use information from this link:
http://www.xpagetips.com/2012/06/extending-your-xpages-applications-with.html
but move to "WEB-INF/lib/..." didn't help
I know I can add my jar to "...Notes\jvm\lib\ext)" or to eclipse plugins but I don't like this solution because I want to store my jar in notes database.
I am trying to deploy R Shiny App as an Windows Desktop App. So far I have used the framework described at http://blog.analytixware.com/2014/03/packaging-your-shiny-app-as-windows.html and managed to make it work with the help of stackoverflow users (question name "R Shiny as Windows Desktop App Creates Text File With Warning").
An update to this framework has been developed and it has several advantages over the previous one, such as not relying on Google Chrome browser etc. and it is described here: http://oddhypothesis.blogspot.com/2016/04/desktop-deployr.html
All files can be found in the GitHub account of framework creator (link is presented in the description)
I have adjusted the following:
app.R
require(shinyjs,quietly = TRUE,warn.conflicts=FALSE)
require(markdown,quietly = TRUE,warn.conflicts=FALSE)
require(scales,quietly = TRUE,warn.conflicts=FALSE)
require(DT,quietly = TRUE,warn.conflicts=FALSE)
runApp("./app/shiny/", launch.browser=TRUE,quiet=TRUE)
packages.txt
Added the names of the packages I am using
# Primary package dependencies for the application that are loaded during
# startup.
#
# If not available, they will be installed into app/library. Custom source
# packages need to be installed manually.
# bare miniminum: configurations are stored in json format
jsonlite
# if deploying shiny based applications:
shiny
shinyjs
markdown
scales
DT
App does launch, it works. However a new folder is created called log with file error.log, which includes the following:
library paths:
... C:/Users/VoronecI/Desktop/New folder (2)/app/library
... C:/Users/VoronecI/Desktop/New folder (2)/dist/R-Portable/App/R-Portable/library
working path:
... C:/Users/VoronecI/Desktop/New folder (2)
Loading required package: methods
ensuring packages: jsonlite, shiny, shinyjs, markdown, scales, DT
Attaching package: 'shiny'
The following object is masked from 'package:jsonlite':
validate
Attaching package: 'shinyjs'
The following object is masked from 'package:shiny':
runExample
The following objects are masked from 'package:methods':
removeClass, show
Attaching package: 'DT'
The following objects are masked from 'package:shiny':
dataTableOutput, renderDataTable
Is there a way to prevent this logging of the unmeaningful error?
The reason why I want to get rid of it is because I further use Inno Setup Compiler to create .exe and this is not working when I have a log file updating each time I run the app.
As you can see in this file (line 66) https://github.com/wleepang/DesktopDeployR/blob/7c81e72c5beb29bf84ca65fd1d5bb5486caec51a/dist/script/wsf/js/run.js
The command is run as
var strCommand = [Rexe, Ropts, RScriptFile, "1>", Outfile, "2>&1"].join(" ");
which redirects command line outputs (that normally directly print to the screen) to the Outfile. You can change this line to
var strCommand = [Rexe, Ropts, RScriptFile].join(" ");
which will disable the logging. This might have other implications though (you might see a command window for example, I am not too sure but test it out).
Alternatively, you might be able to change this file https://github.com/wleepang/DesktopDeployR/blob/7c81e72c5beb29bf84ca65fd1d5bb5486caec51a/app/config.cfg (line 27) and set
- use_userprofile: true
(you need to uncomment this line, it is currently inside a block comment). This will make sure the log file goes into the user profile folder, and that might also solve your problem.
Ivona, I just finished developing the RInno package which also uses Inno Setup and the DesktopDeployR project to install local Shiny apps, and it will log errors without a problem.
To get started:
install.packages("RInno")
require(RInno)
RInno::install_inno()
Then you just need to call two functions to create an installation framework:
create_app(app_name = "myapp", app_dir = "path/to/myapp")
compile_iss()
If you are interested in other features, check out FI Labs - RInno. I'd be interested to know if turning off the error logging feature is something you would like to add ;)
I want to use clearNLP (http://clearnlp.wikispaces.com/) for extracting semantic role labels of an input sentence. I followed the instructions here: http://clearnlp.wikispaces.com/installation (I downloaded the jar files, put them in a directory called ClearNLP and set the classpath) but when I run the command java com.clearnlp.run.Version, I face the error: Could Not find or Load Main.
I tried it twice: Once I set the classpath as an environment variable of windows and ran the command in CMD. But, when it didn't work, I tried to create a java project, set the libraries using NetBeans and run the program. But, it didn't work, too.
BTW, when I run echo %classpath% command, I see that the classpath is set correctly.
Can anybody help me?
Try Eclipse. I included the jars in a new project I created. I then created a simple class like so
package test;
import com.clearnlp.run.Version;
public class TestClearNLP {
public static void main String(args[]) {
Version.main(args);
}
}
When run, this creates output in the console of:
ClearNLP version 2.0.2
Webpage: clearnlp.com
Owner : Jinho D. Choi
Contact: support#clearnlp.com
The only weird situation I ran into was that Eclipse did not like the jar files beginning with a period. I removed those from my project and ran with the remaining libraries.
Ok, I'm stumped here. I'm using Matlab version 2013b with a Java RTE of 1.7.0_11 and I'm trying to run a simple piece of code to see if Matlab is able to read the .jar file and nothing seems to be working.
Here is the Java code, which is compiled to a .jar named JavaOCT.jar, which is placed in the Matlab working directory:
package VTK;
public class vtkVolumeView{
public int Test(){
return 10;
}
}
That is it, no other dependencies, nothing fancy. In Matlab, I try:
javaaddpath('\JavaOCT.jar'); %<-Directory and name are 100% correct
import VTK.*; %<-Package name from above
methodsview VTK.vtkVolumeView; %<-Can't find the class, argh!
Matlab kicks back that it can't find the class.
Things I've done to try and solve the problem:
Reverted to the exact same JDK as the Matlab RTE
Tried an older 1.6 JDK
Done lots of stack overflow research to try and solve it 1 2 3 4
Tried used javaclasspath and pointing to the compiled class instead
Read the Matlab documentation 5
Using clear -java after the javaaddpath
Any help would be appreciated, it is driving me nuts!
Update: Daniel R suggested just javaaddpath('JavaOCT.jar') which doesn't work either.
Final update: It finally works! I wasn't building the .jar properly. In IntelliJ, click on the project and hit F4. This brings up the Project Structure, then go to Artifacts and click the green + button and add DirectoryContent and then point to the out\production. Once this is done, as mentioned by others, it should show up in Matlab as an expandable .jar.
I don't know which operating system you are using, but the ./ seems invalid.
Try javaaddpath('JavaOCT.jar'); or javaaddpath(fullfile(pwd,'JavaOCT.jar'));.
What does exist(fullfile(pwd,'JavaOCT.jar')) return?
Some things to try:
Add the class file. When using a package, you need to add the class file in at the host of the package. For example, if your code is here:
\\full\path\to\code\VTK\vtkVolumeView.class
Then use:
javaaddpath('\\full\path\to\code')
I'm still suspicious of your *.jar path. You should usually use absolute paths when adding jar files. Try adding the results of which('JavaOCT.jar')
How did you make your jar file? Does it contain the appropriate directory structure implied by your package declaration?
I'll try to illustrate the problem as simple as I can.
I have a JAR file, which I extracted using Winrar. (The jar file contains an open source android library).
I want to modify this JAR file by adding a new class to the library.
So here are my steps:
First, I created a class using Eclipse and set the package name same as the android's library package name.
Second, I copied this java File to the folder of the other java files in the library.
Third, I tried to compile the JAVA file via the CMD using javac.
The path of the new java file and the other .JAVA and .CLASS files of the library is: C:\com\example\core\
The name of the new java file would be: "MyNewClass.java"
The command I run via the CMD is: javac C:\com\example\core\MyNewClass.java
But, during the compilation I get many errors saying: Cannot find symbols.
I've been looking up for a solution of this problem but couldn't figure how to solve it and make the new JAR File having another class that I created seperately.
What am I missing?
As per earlier comments:
Rather than trying to modify the JAR, you can get access to the full source code of the Universal Image Loader library by cloning the repository using git or hitting "Download ZIP" on the righthand side of the page you linked.
Once you have the source, import the library in your IDE. From there on you'll be able to build the whole thing from scratch, make any adjustments/modifications you like, etc.
Your classpath might be wrong or there might be some mistake in package name.
When a Java program is being compiled the compiler it creates a list of all the identifiers in use. If it can't find what an identifier refers to it cannot complete the compilation. This is what the cannot find symbol error message is saying, it doesn't have enough information to piece together what the Java code wants to execute.
Try:
javac -cp com/* C:\com\example\core\MyNewClass.java
That should make the compiler aware of all the other classes under com/...