Intellij 12 Ultimate is having problems with international characters - internationalization

I have multiple problems with Intellij 12 on my Mac.
If I create a project with in a directroy containg norwegian characters, the IDE is not able to find the project directory and will not even start the compile process
If I have a Java Class with an international character, the compiler throws this out
13.app/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain Fårekjøtt
Exception in thread "main" java.lang.ClassNotFoundException: F��rekj��tt
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
Process finished with exit code 1
What is the correct way to go about fixing this?

Mac SDK 1.7_40 has a fix for a known bug causing this problem. If you add the Oracle SDK 1.7_40 to IDEA, it compiles.
From Jetbrains support;
You are trying to compile with Oracle JDK 1.7 on Mac which has known
problems with encoding on this system. Please use the default Apple
JDK to avoid this problem or convert your files to UTF-8. I've
verified that compilation with Apple JDK 1.6 works without problems:
https://www.dropbox.com/s/4rga4d0zphksvvd/Screenshot%202013-10-04%2020.20.44.png
. Don't forget to remove the invalid -encoding option that you have
added to Preferences | Compiler. If using JDK 1.6 is not an option,
you can also try JDK 1.7.0_40 version from Oracle which may (or may
not) have a fix for this problem.

Related

Could not determine java version from '17'

When I going to setup my Spring boot project in spring tool suite 4.12.1 as Gradle(STS) project I got error like "Could not determine java version from '17'. But project is used java 11. Gradle version is 6.8.3. I cloned project from git successfully. My machine already installed Java 11. But can not import as Gradle(STS). Could anyone please help me. I am new to spring tool suite.
Below you can see my exception stack trace.
java.lang.IllegalArgumentException: Could not determine java version from '17'.
at org.gradle.api.JavaVersion.toVersion(JavaVersion.java:63)
at org.gradle.api.JavaVersion.current(JavaVersion.java:72)
at org.gradle.tooling.internal.consumer.ConnectorServices.assertJava6(ConnectorServices.java:58)
at org.gradle.tooling.internal.consumer.ConnectorServices.createCancellationTokenSource(ConnectorServices.java:40)
at org.gradle.tooling.GradleConnector.newCancellationTokenSource(GradleConnector.java:74)
at org.springsource.ide.eclipse.gradle.ui.util.UIJobUtil$1.<init>(UIJobUtil.java:51)
at org.springsource.ide.eclipse.gradle.ui.util.UIJobUtil.withProgressDialog(UIJobUtil.java:49)
at org.springsource.ide.eclipse.gradle.ui.wizards.GradleImportWizardPageOne.populateProjectTree(GradleImportWizardPageOne.java:493)
at org.springsource.ide.eclipse.gradle.ui.wizards.GradleImportWizardPageOne.access$11(GradleImportWizardPageOne.java:491)
at org.springsource.ide.eclipse.gradle.ui.wizards.GradleImportWizardPageOne$9.widgetSelected(GradleImportWizardPageOne.java:429)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5884)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1522)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5126)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4576)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
at org.eclipse.jface.window.Window.open(Window.java:799)
at org.eclipse.ui.internal.handlers.WizardHandler$Import.executeHandler(WizardHandler.java:153)
at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:283)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:317)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:251)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:389)
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:366)
at org.eclipse.ui.internal.views.helpers.EmptyWorkspaceHelper$ImportAction.run(EmptyWorkspaceHelper.java:406)
at org.eclipse.ui.internal.views.helpers.EmptyWorkspaceHelper$1.linkActivated(EmptyWorkspaceHelper.java:284)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleActivate(AbstractHyperlink.java:215)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleMouseUp(AbstractHyperlink.java:309)
at org.eclipse.ui.forms.widgets.AbstractHyperlink.lambda$3(AbstractHyperlink.java:117)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5884)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1522)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5126)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4576)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1041)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
Here session data in error log.
eclipse.buildId=4.12.1.202110260750
java.version=17
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.springframework.boot.ide.branding.sts4
Command-line arguments: -data file:/home/niro/Documents/workspace-spring-tool-suite-4-4.12.1.RELEASE/ -os linux -ws gtk -arch x86_64 -product org.springframework.boot.ide.branding.sts4
This is most likely caused by the JDK that is used to run the IDE is not supported yet by the Gradle version that is being used by the project. In your case it looks like the IDE is running on the embedded JDK17, which might not be supported yet in Gradle (not sure about that, but the exception looks like that).
You can fix this in two different ways:
One solution is to update the Gradle version that is used in your project. Gradle 7.3 supports JKD17 and switching your project to that version should allow the IDE to import it just fine (usually in the gradle-wrapper.properties file).
The other solution would be to modify the -vm setting in the SpringToolSuite4.ini file and let it point to a java executable from an older JDK (at least JDK11, but maybe your projects Gradle version works with JDK16 as well). After that change, open the IDE again and try to import your project again.

Use Nd4j in an Intellij project

I'm trying to use Nd4j in a Kotlin project in Intellij IDEA. In Project Structure -> Libraries, I used the "From Maven" command to add the following libraries.
org.deeplearning4j:deeplearning4j-core:1.0.0-beta
org.nd4j:nd4j-native-platform:1.0.0-beta
org.datavec:datavec-api:1.0.0-beta
With those libraries I can compile my project, but when I run it fails with an exception.
Caused by: java.lang.RuntimeException: ND4J is probably missing dependencies. For more information, please refer to: http://nd4j.org/getstarted.html
at org.nd4j.nativeblas.NativeOpsHolder.<init>(NativeOpsHolder.java:51)
at org.nd4j.nativeblas.NativeOpsHolder.<clinit>(NativeOpsHolder.java:19)
... 10 more
Caused by: java.lang.UnsatisfiedLinkError: no jnind4jcpu in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1220)
at org.bytedeco.javacpp.Loader.load(Loader.java:980)
at org.bytedeco.javacpp.Loader.load(Loader.java:879)
at org.nd4j.nativeblas.Nd4jCpu.<clinit>(Nd4jCpu.java:10)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.bytedeco.javacpp.Loader.load(Loader.java:938)
at org.bytedeco.javacpp.Loader.load(Loader.java:879)
at org.nd4j.nativeblas.Nd4jCpu$NativeOps.<clinit>(Nd4jCpu.java:1310)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.nd4j.nativeblas.NativeOpsHolder.<init>(NativeOpsHolder.java:29)
... 11 more
Caused by: java.lang.UnsatisfiedLinkError: no nd4jcpu in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1220)
at org.bytedeco.javacpp.Loader.load(Loader.java:965)
... 21 more
Looking through the project folder I see that IDEA has downloaded lots of jar files for nd4j-native-platform, but there's no sign of any JNI libraries. What else do I have to do?
Intellij's "From Maven" feature doesn't support the classifiers that JavaCPP and ND4J (and other libraries that use native code) use. Maven will work great but if you really can't use it for some reason, you can manually add the nd4j-native-1.0.0-beta2-macosx-x86_64.jar file and openblas-0.3.0-1.4.2-macosx-x86_64.jar file. That should be enough to run simple things, but you'll have to manually do that for every other native dependency as you use more and more stuff (like OpenCV). That's why Maven is recommended.
If you include those 3 dependencies, there are zero reasons why it should fail unless you're on an unsupported OS for some reason.
We support everything from android to IBM power so that is unlikely though.
I'm also confused by what you mean about not seeing any JNI libraries. Those are all in the jar files. We use javacpp (which we also maintain) to manage those things.
You will find those libraries under ~/.javacpp/cache - you should not have any reason to touch those though.
Could you clarify what you are looking for there?
Beyond that, there is nothing else you have to do. I'm assuming something just didn't load correctly.
Our standalone pom works out of the box: https://github.com/deeplearning4j/dl4j-examples/blob/master/standalone-sample-project/pom.xml - maybe double check this, that or reload. I can only assume you created the project wrong somehow. File -> New Maven project should be all you need to do.

Stanford POStagger demo fails on Windows

I am trying to run the Stanford POSTagger (version 3.6) using the Windows cmd and I am having problems. I am following the instructions in the README with the corrections for Windows.
I have a directory (C:\Program Files\stanford-postagger-full-2015-12-09>)with the POSTagger files.
In the command prompt I am at this directory (..Stanford-postagger-full...).
1)The command: javac -cp stanford-postagger.jar TaggerDemo.java is executed correctly (no error message)
2)The command: java -cp ".;stanford-postagger.jar" TaggerDemo models\wsj-0-18-left3words.tagger sample-input.txt fails. I am getting the following error:
C:\Program Files\stanford-postagger-full-2015-12-09>java -cp
".;stanford-postagger.jar" TaggerDemo
models\wsj-0-18-left3words.tagger sample-input.txt
Exception in thread
"main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at edu.stanford.nlp.io.IOUtils.(IOUtils.java:42)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.readModelAndInit(MaxentTagger.java:765)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.(MaxentTagger.java:298)
at edu.stanford.nlp.tagger.maxent.MaxentTagger.(MaxentTagger.java:263)
at TaggerDemo.main(TaggerDemo.java:20) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 5 more
Any suggestions about my error? Am I at the correct directory to run the commands?
I believe there is another .jar file that you need to add to the classpath. If you look at the error, you'll see that the class that isn't found is org/slf4j/LoggerFactory, which is in .\lib\slf4j.jar.
On a side note, you might want to get a program like 7zip, which allows you a convenient (right-click) method for viewing the contents of .zip and .jar (etc) files. That way, you'll be able to find those classes that you can't find otherwise.
Hope that helps—I'm still new to java.

Gradle wrapper NoClassDefFoundError

When I run ./gradlew I get
Exception in thread "main" java.lang.NoClassDefFoundError:
org/gradle/wrapper/GradleWrapperMain Caused by:
java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:190) at
java.lang.ClassLoader.loadClass(ClassLoader.java:306) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at
java.lang.ClassLoader.loadClass(ClassLoader.java:247)
My project compiles using the Android Studio but stopped compiling from command line
Probably something went bad. The solution:
Install gradle: brew install gradle
Regenerate wrapper: gradle wrapper
See https://github.com/drone/drone/issues/256
My .gitignore had *.jar in it, so I wasn't getting all the jars I needed in my repository.
I had the same, or similar, problem when trying to build my app from command line, but with an exception thrown for 'java.lang.ClassNotFoundException: com.sun.tools.javac.util.Context' which did not happen when building within Android Studio. I found out that AS brings along it's own JRE and I resolved the issue by setting 'JAVA_HOME' to the AS JRE path. In my case it turned into:
$ JAVA_HOME=/opt/android-studio/jre ./gradlew build
You can find this path under 'File' -> 'Project Structure' -> 'SDK Location', see screenshot.
I hit this issue when I have a directory with a ":" (no quotes, just a colon) in it.
This was on a linux machine.
Before:
"my:directory"
as in
/Users/me/projects/project1/my:directory/
then i renamed it to
/Users/me/projects/project1/my_directory/
and the error went away.

Trouble installing Kyoto Tycoon - Java. Maven failing

I've downloaded Kyoto Tycoon via:
hxxps://bitbucket.org/EP/kyototycoon-java
When running mvn install I get plenty of warnings telling me it couldn't find several files:
http://pastebin.com/znpJ3d5n
When I first started running the install I was getting a lot of failures and no errors. After blindly going around and trying to install things separately, the output now looks like this. I have no experience with Maven so editing the pom.xml file is out of the question. I've tried using the ignore tests and compiling, and I get few jar files. This allows me to compile "Example.java" using:
javac -cp .:target/kyototycoon-0.2-SNAPSHOT.jar Example.java
I then try to run the code using:
java -cp .:target/kyototycoon-0.2-SNAPSHOT.jar Example
but I get an runtime error:
Exception in thread "main" java.lang.NoClassDefFoundError: Exception in thread "main" java.lang.NoClassDefFoundError: com/twitter/finagle/Codec
at kyototycoon.SimpleKyotoTycoonClient.<init>(SimpleKyotoTycoonClient.java:16)
at Example.main(Example.java:11)
Caused by: java.lang.ClassNotFoundException: com.twitter.finagle.Codec
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 2 more
I'm assuming this all comes back the the maven install failing, but I'm not sure how to fix it.
Any direction is appreciated. There doesn't seem to be a large support group for Kyoto.
For anyone experiencing this same issue, I found that JAR files I needed were being created. They were being stored in ~/.m2/repository/kyototycoon/kytotycoon/. I created a disgusting looking classpath that included all of these JAR files and this allowed me to compile AND run the Example.java file.
If "editing the pom file is out of the question" I'd strongly recommend steering clear of Maven.
In any case, you can install local jars to your repository if the artifact isn't available from any repository.

Resources