how to configure java on windows 10 - java

I suddenly found that I could no longer run my own developed JAVA apps by simply double-clicking the JAR file - it reported that the main class was not found.
With trial and error I found that if I forced 32-bit JAVA 1.8.0_161 to run then things worked fine. What was running by default was 64-bit JAVA 1.9. I also found it was not using JAVA_HOME but instead was running what it found in %APPDATA%\Oracle\Java.
I tried lots of things but in the end I uninstalled the 64-bit JAVA 1.9, put the path for 1.8.0_161 in JAVA_HOME, put %JAVA_HOME%\bin in the PATH and that got me most of the way...
Now if I run java -jar <jarFileName.jar> then my program runs just fine, but if I attempt to run the jar file by double clicking on it then it still could not load the main class.
Windows 10 default programs for JAR files says Java(TM) Platform SE Binary - tried forcibly changing this to point to the java.exe for 1.8.0_161 but that still doesn't work.
The JAVA Settings Console doesn't look like the ones in various web queries - I think it changed with 64-bit JAVA.
So I suspect my system is no longer properly configured.
How do I fixup the configuration to get back to where I can simply double click a JAR file in order to run it.
Best Regards
SteveM

Related

How do I install Pentaho BI CE on windows?

I'm sure this has a relatively simple answer -_- , but I keep getting a ton of errors and I have no idea why.
Here is the guide I am following:
http://akbarahmed.com/2012/05/12/install-pentaho-bi-server-4-5-on-windows-7-x64/
I am using Java 1.8.0.05, and biserver-ce-5.0.1-stable
When I run start-pentaho.bat, and the Tomcat window opens, I get a whole host of errors.
If I go to localhost:8080/pentaho, I get the following errors:
One or more system listeners failed. These are set in the systemListeners.xml.
org.pentaho.platform.api.engine.PentahoSystemException: PentahoSystem.ERROR_0014 -
Error while trying to execute startup sequence for
org.pentaho.platform.repository2.unified.BackingRepositoryLifecycleManagerSystemListener
I have gone through this entire process 3 times, but nothing seems to work.
There are 3 things you have to take care of:
When running on windows, it is easy to run into Windows' path-length limitation. This then will break the jar-loading which in return gives you random errors as the Tomcat server cannot find the classes contained in these jars. So when you install, do not install it deep into a directory, keep it at the root of your disk. From hard experience, I now always install it in DRIVE:\Pentaho
The Server will not run without the system database. If your logs show you a Quartz-Error, or a Hibernate error, then your HSQL database is not running. In the download, you'll find a "data" directory. Start the "start-hypersonic.bat" before you start the main Pentaho server.
Pentaho does not run with Java 8. There seem to be some incompatible changes in the JDK and I have not been able to actually start it up correctly. You have to use JDK 1.7 to be successful. ALso make sure that your JAVA_HOME or PENTAHO_JAVA_HOME points to the correct JDK.
The Pentaho bat files try to locate a Java installation automatically, and without explicitly setting these environment variables, any JDK may be picked up at random. Usually that is the last JDK that has been installed or updated. So to be safe, lock down the JDK by setting these variables (via Control Panel-> System -> Advanced System Settings -> Environment Variables)
You need to check the catalina.out and pentaho.log files (both should be at biserver-ce/tomcat/logs).
They'll give you more detail on why the server is not starting.
I was having the same error when I installed Java 8 and even after I reinstall Java 7 without removing Java 8 completely.
Remove all Java installations, then you install Java SDK 7
Set the environment variable PENTAHO_JAVA_HOME as your Java 7 path
Then you reboot your computer
Then you start Pentaho BI Server
Hope this help you.
BTW, don't use IE or Safari.

Java Runtime Environment not found error

I've been working on Aptana Studio and some JRE required software for a bit of time now , but since yesterday something quite odd happened, as suddenly the software that requires it threw me an error No Java virtual machine was found . Last thing I did before that was restoring my system files permissions thought safe mode as I had some trouble with that , could this have anything to do with it ?
I've tried installing JRE once again , no results. However when I run
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
I do get the following
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Aptana gives me the following error
No Java virtual machine
was found after searching the following locations:
/Applications/Aptana Studio 3/AptanaStudio3.app/Contents/MacOS/jre/bin/java
java in your current PATH
And other software such as Spine won't simply start.
My .bash_profile is the following :
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
PATH="/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin:${PAT$
export PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
The output of echo $PATHis the following
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
The output of echo $JAVA_HOME is the following
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
And Java invocations on the terminal work.
Guidance will be highly appreciated.
After trying Peter's suggestion the problem persisted but now in another context : "/System/Library/Frameworks/JavaVM.framework" does not contain the JNI_CreateJavaVM symbol"
After struggling for many hours, and reading about people with the same issue opting to re-install the entire OS , decided to examine the issue from another perspective, the thing I first mentioned here that I believe went unnoticed was that I restored my permissions before this happening, so what I did was the following.
After reading a bunch of articles about Apple no longer providing Java support themselves but Oracle providing it, reasoned through it and realized that perhaps paths (Often called directories) from Apple's final Java release may have not been strictly the same as the new Oracle releases, so decided to wipe out all recent Oracle Java Runtime Environment that I found on /Library/Java/JavaVirtualMachines and delete the Java Applet Plugin from /Applications (Just search for it on your /Applications path) .
Installed Apple's last stable release from the following link.
Located where Apple located their Java releases : /System/Library/Frameworks/
My particular interest was the Java Runtime Environment , so I explored the JavaVM directory on /System/Library/Frameworks/
Found out that all Apple's JRE previous releases reside on a directory called Versions that is within /System/Library/Frameworks/JavaVM.framework directory, here's where I noticed something rare, for some reason at the moment I restored file permissions from my Disk Utility Application , this directory was made inaccessible (By not giving the root user permissions to access anything in itself).
Went to my terminal console and inside the JavaVM.framework directory modified the permissions to that directory to be accessible for all users by running the following command chmod -R 777 Versions.
After executing these actions I went straight to my JRE-Required software and attempted to open it , success!
Things to learn from the issue.
Oracle's Java JDK/JRE are located in different paths from Apple's. (If you are struggling with some other issue, verify your Java version to determine your Java installation directory)
Apple's disk utility application might define different permissions than expected for some files. (After restoring permissions verify that everything's working fine, if not this may be the cause of your problems.)
Looks like AptanaStudio (Eclisebased right?) assumes that you have a JRE inside the Aptana directory (/Applications/Aptana Studio 3/AptanaStudio3.app/Contents/MacOS/jre/bin/java)
I assume that there is nothing there. Simplest way would be to symlink your existing JRE installation to that directory:
ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre /Applications/Aptana\ Studio\ 3/AptanaStudio3.app/Contents/MacOS/jre
Or you could start Aptana from the terminal and specify the path to java with -vm:
./aptana -vm "/path/to/java/bin/directory"
Environment variables that must be available to GUI applications are a bit tricky in OsX (at least in my experience).
It is possible to set global PATH (and other variables) in /etc/launchd.conf, see for example here and /etc/paths.d see here.
Simple Solution
For Windows:
1.download the JAVA runtime environment x86(32bit) version else you will get an error with dll file from here http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
Extract the folder out of the .tar file you downloaded.
Rename the JRE folder to "jre"
Then paste it in to this directory
C:\Users\"User Name"\AppData\Roaming\Appcelerator\Aptana Studio
This worked for me
I uninstalled all my Java JREs and JDK for Windows 10. Then I downloaded Aptana again and let it install Java for me. I think JAVA 8 was my problem, but this worked and I can still install the other versions again.

Tomcat 7 startup error: tcnative.dll is not valid

I use;
Windows 7 64 bit,
JAVA_HOME= JDK1.7 64 bit,
Tomcat-7 64 bit version
When I start tomcat from commandline it works ok, but when I use it within IntelliJ I get this error;
java.lang.UnsatisfiedLinkError: tcnative-1 (.\tcnative-1.dll is not a valid Win32 application.
I also point to an IBM 32bit JDK1.6 from IntelliJ in project settings, but this could not be a problem since this setup works on some other collegae's computers
I have read similar questions here, but none of them offers a solution for my case, any ideas, how can I fix this?
Here is a link which describes the problem :
Cause:
You get this message when you start Tomcat. Tomcat is looking for a shared object call tcnative (dll or so depending on the platform). If it doesn't find it, it'll revert to java libs. Either way, this shouldn't affect your application. tcnative dll is needed to address scalability in Tomcat.
Solution:
Turn down debugging level for Tomcat or
Get tcnative from http://tomcat.apache.org/native-doc/ (windows users can download the binary) and place it in your library path.
Lib path is usually: C:\Program Files\Apache Software Foundation{Apache Tomcat directory}\lib; for windows
Basically It seems that you may have an incorrect version.
Are you using multiple java on your machines if yes then try to look into environment variables for JAVA_HOME & PATH. Secondly, also paste the complete version of java and tomcat
Also run following commands at command prompt
java -version
javac -version
echo %JAVA_HOME%
And are you using MSI installer of tomcat or just a zip version of tomcat. Because in many cases MSI installer never work for some ghost reasons.

Trying to run ant - getting error

I have just installed ant and JDK 6 and am trying to run an ant task. I get the following:
C:\Users\Giles Roadnight\workspace\Parsley\build>ant compile_spicelib_complete_flex
Buildfile: build.xml
compile_spicelib_complete_flex:
[exec] Error loading: C:\Program Files\Java\jdk1.6.0_17\jre\bin\server\jvm.dll
[exec] Result: 6
BUILD SUCCESSFUL
Total time: 0 seconds
C:\Users\Giles Roadnight\workspace\Parsley\build>
That file - jvm.dll is definitely there. I have tried running as an administrator with the same result.
To install I ran the JDK installer (I already had a JRE installed), I set up JAVA_HOME in my environment variables.
I unzipped ant and added my ant bin directory to my PATH.
I am clueless about Java and how it all works so am a bit lost with this.
I am on 64 bit windows 7. I downloaded a 64 bit JDK.
Any help much appreciated.
you must have Unzipped your flex to some folder. I am referring to this folder as flex_sdk.
Add flex_sdk to the FLEX_HOME environment variable (creating the environment variable if necessary).
Flex compiler needs a 32 bit JRE since there is currently no support for 64 bit JRE. For this, first download a 32 bit(or X86) version of jdk and later have the flex sdk point to it.To do so, you'll need to edit the jvm.config file located in FLEX_HOME\bin. Within jvm.config, set java.home to the location of your 32 bit JDK as shown.(Note that these are not backslashes)
Example: java.home=C:/Program Files (x86)/Java/jdk1.6.0_25 Alternatively, you can also add an environment variable with the name JAVA_HOME and have it point to the above location if you are not able to find the jvm.config file.
/I had the same problem and researched on this for a couple of days. Tried 100s of classpaths and loads of corrupted registry issues. The above solution seemed to work for me. Let me know if it works for you as well/
-Prasad K
It looks to me as if the ant script is running a native program which in turn tries to load the JVM to run some java code, and fails. I would guess that there is a mismatch between 32-bit and 64-bit-ness. The package you are trying to run is, in this theory, using a 32-bit Windows executable which is failing to LoadLibrary the 64-bit JVM DLL.
A simpler possible explanation is that many things in the Java universe get befuddled by spaces on pathnames. Try installing the JDK in a pathname with no embedded spaces.
You can solve this by creating a bat file in the flex-sdk bin directory with the following:
"%JAVA_HOME%\bin\java.exe" -Xmx384m -Dsun.io.useCanonCaches=false -jar "%~dp0\..\lib\mxmlc.jar" +flexlib="%~dp0\..\frameworks" %*
Then invoke this bat file instead of mxmlc.exe
Note: solution found at https://web.archive.org/web/20120327204229/http://sray.squidpower.com/2010/01/13/solution-to-error-running-mxmlcexe-with-windows-64bit-jvm/
The first part that surprises me is that it tries to use the server JVM instead of the regular one, but that might be a feature of your build. The second thing I'd try is to run ant -v instead of plain ant. This should give you a lot more output and hopefully more information as to what ant is trying to do at this point in time.

"Could not find the main class. Program will exit"

I'm trying to run SQuirreL SQL.
I've downloaded it and installed it, but when I try to run it I get this error message:
Java Virtual Machine Launcher.
Could not find the main class.
Program will exit.
I get the gist of this, but I have not idea how to fix it. Any help?
more info:
I'm on Windows XP pro.
I have java 1.6 installed, and other apps are running OK.
The install ran OK.
I believe I've followed the installation instructions correctly.
To run it, I'm invoking the squirrel-sql.bat file.
Update
This question: "Could not find the main class: XX. Program will exit." gives some background on this error from the point of view of a java developer.
Is Java installed on your computer? Is the path to its bin directory set properly (in other words if you type 'java' from the command line do you get back a list of instructions or do you get something like "java is not recognized as a .....")?
You could try try running squirrel-sql.jar from the command line (from the squirrel sql directory), using:
java -jar squirrel-sql.jar
The classpath is the path that the system will follow when trying to find the classes that you're trying to run. In the batch file you're trying to execute it probably has a variable like CLASSPATH=blah;blah;etc or a java command that looks similar to
java -classpath "c:\directory\lib\squirrel-sql.jar" com.some.squirrel.package.file
If you can find or add that classpath setting, make sure that it includes a path to the squirrel-sql.jar and any other jar files that it may depend on separated by semicolons (or the root /lib directory that may be included with the installation).
Basically you just need to tell java where to find the class files that you're trying to execute. Wikipedia has a more indepth discussion about classpath and can offer you more insight. http://en.wikipedia.org/wiki/Classpath_(Java)
JAVA_HOME variable must be set, to point to the prog files/java/version???/bin
open squirrel-sql.bat file with some text editor and see if the JAVA_HOME variable there is the same as the one in your enviroment variable
change it if it doesn't match....and than run bat file again
Have you followed these instructions:
http://www.squirrelsql.org/#installation
If so, are you running the batch file or the shell script to run it?
Tweaking MB's answer for windows, will get rid of the console window:
start javaw -jar squirrel-sql.jar
The .bat file does not seem to work.
Just double-click on:
squirrel-sql.jar
or type:
java -jar squirrel-sql.jar
in the command-line.
You can place .; in classpath in environmental variables to overcome this problem.
I tried to start SQUirrel 3.1 but I received a message stating "Could not find the main class Files\Rational\ClearQuest\cqjni.jar" I noticed that C:\Program Files\Rational\ClearQuest\cqjni.jar is in my existing classpath as defined by the Windows environment variable, CLASSPATH.
SQUirrel doesn't need my existing classpath, so I updated the SQUirrel bat file, squirrel-sql.bat.
REM SET SQUIRREL_CP=%TMP_CP%;%CLASSPATH%
SET SQUIRREL_CP=%TMP_CP%
It no longer appends my existing classpath to its classpath and runs fine.
I had this problem when I "upgraded" to Windows 7, which is 64-bit. My go to Java JRE is a 64-bit JVM. I had a 32-bit JRE on my machine for my browser, so I set up a system variable:
JRE32=C:\Program Files\Java\jre7
When I run:
"%JRE32\bin\java" -version
I get:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
Which is a 32-bit JVM. It would say "Java HotSpot(TM) 64-Bit" otherwise.
I edited the "squirrel-sql.bat" file, REMarking out line 4 and adding line 5 as follows:
(4) rem set "IZPACK_JAVA=%JAVA_HOME%"
(5) set IZPACK_JAVA=%JRE32%
And now everything works, fine and dandy.
I had the same issue with a different application (BI Publisher) because I installed a 32 bit version of this application on a 64 bit version of Windows.
Java Virtual Machine Launcher - could not find the main class
The solution for my case was to tell BI Publisher where to find the x86 version of JRE:

Categories