Java Code Compatability issue (my binary is also not working) - java

I have written a Java application using Eclipse Juno on Fedora 17. I have JRE 1.7 installed, but I changed the Java build path to 1.6, I believe. Everything works fine there. I can then build a .jar file which runs on a Windows 7 virtual machine without problems. However, if I try to run it on the school computers (Windows 7
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing))
it gives an exception like: java.lang.IllegalArgumentException: cannot add to layout: constraint must be a string. This is apparently something to do with CardLayout, which I believe is a standard Swing component.
I am using miglayout library and sqlite-jdbc driver if that could be related.
I would really appreciate help with this

I found the problem.
cardLayoutPanel is a JPanel
cardLayout is obvious
identifier is a String
cardLayoutPanel.add(container);
cardLayout.addLayoutComponent(container, identifier);
turns out that in Java 1.6 this doesn't really work because it should actually be:
cardLayoutPanel.add(container, identifier);
without the second line
Java 1.7 doesn't complain for some reason. Weird.

Related

zap is not installing

i dont know why its not installing i dont know what to do error image
its showing this i did instal java 64 bit jre its not working please hele me
i tride to delete and install again it did'nt work
i delete it many times and install
still its not installing zap its showing the same thing locate java 64 bit file
i also tride to locate the file it did'nt work but i dont know where the file is if i know where the file is its not selecting the file
Based on the error message:
You didn't install a JRE >= Java 11.
You installed a 32bit JRE.
Your JRE can't be found. (If you're using Adopt OpenJDK or Temurin, etc. [I can't think of all of them.] there's an option to set JAVA_HOME and JavaSoft registry keys, you should enable those. Plus may need to reboot before installing [thanks Windows 🤷‍♂️].)
I have had this issue myself. ZAP really is a PITA on Windows. One thing I noticed is that on my Windows host, which will not run the ZAP installer, I'm using Oracle's Java:
C:\Users\Administrator>java -version
java version "1.8.0_361"
Java(TM) SE Runtime Environment (build 1.8.0_361-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.361-b09, mixed mode)
on my Linux host which runs it fine:
──(kali㉿PwnBox)-[~]
└─$ java -version
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment (build 17.0.6+10-Debian-1)
OpenJDK 64-Bit Server VM (build 17.0.6+10-Debian-1, mixed mode, sharing)
So I deduce the difference is that ZAP doesn't like Oracle's JRE and wants OpenJDK/JRE. Thankfully, there are builds available for Windows here:
https://learn.microsoft.com/en-us/java/openjdk/download
So give that a go. In my instance I have other software that depends on Oracle's JRE, so I do not want to endanger that apps reliability by installing another JRE. So I just use ZAP 2.12 on my Linux host and ZAP 2.11 on Windows, which runs fine in Oracle JRE.
Side Note:
ZAP really is half-baked. As far as web app testing goes, I pay for BurpSuite Pro because it's so vastly superior in every measurable way. I have all kinds of headaches with ZAP and it's always a battle. That's if it can even finish a scan without crashing on larger apps (it usually can't).
Anyway, I hope this helps. But I would also suggest seeking out alternatives to ZAP until the developers get their act together. Then again, I guess you get what you pay for, so......

Violet UML Editor doesn't start on mac

I am using eclipse for a coding course at school, and I am required to install Violet UML Editor http://alexdp.free.fr/violetumleditor/page.php to create PDF of classes.
Anyway, I downloaded a .jar file. My mac doesn't like that it's from an unverified developer so I must manually allow it to open in system preferences. The .jar opens to the loading tab but it wont open the program.
'''Javac -version''' in terminal says javac 16.02. As far as I know, JDK holds JRE which I need to run Violet. To be safe I installed JRE from Oracle which was a JDK 8 file but it didn't work so I just deleted it.
UPDATE: Using terminal and entering '''java -jar violetumleditor-3.0.0.jar''' I get the error code
Error: Unable to access jarfile violetumleditor-3.0.0.jar
the .jar is located on my desktop, it should be found
Also yes I did a fresh 3.0 version install to try and the same thing.
UPDATE 2:
java -version gives
java version "16.0.2" 2021-07-20
Java(TM) SE Runtime Environment (build 16.0.2+7-67)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)
Thinking it's a permission with accessing desktop issue.
There is a bug open for this:
https://sourceforge.net/p/violet/bugs/69/
I personally don't think it would be fixed anytime soon.
I can recommend two alternative tools such as:
https://www.visual-paradigm.com/solution/uml/uml-tool-for-mac/
https://gitmind.com

Using RWeka M5P in RStudio yields java.lang.NoClassDefFoundError: no/uib/cipr/matrix/Matrix

I have an R Script which used to work fine where I use RWeka's M5P-algorithm.
For reasons unknown to me, it stopped working properly and now I get
Error in .jcall(o, "Ljava/lang/Class;", "getClass") :
java.lang.NoClassDefFoundError: no/uib/cipr/matrix/Matrix
Presumably this has something to do with me updating RStudio or Windows or R or some package. The odd thing is, that the script works fine when I run it from the simple R gui. So this seems to be related to RStudio and rJava (a possible problem source pointed out here). Still, I don't know how to fix this, all advice I read so far concerns MacOS or Linux, but I am on Windows 10. My Java version is
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) Client VM (build 25.72-b15, mixed mode)
My colleague can run the same script without problems on Windows 10 (same updates due to company policy) and RStudio (same version: 1.0.136). Her Java version is
java version "1.8.0_101",
Java(TM) SE Runtime Environment (build 1.8.0_101-b13),
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
So it seems to be some accidental misconfiguration on my PC but I just don't know where to look.
Can anyone help me?
platform x86_64-w64-mingw32 arch x86_64
os mingw32 system x86_64,
mingw32 status major
3 minor 3.2
year 2016 month 10
day 31 svn rev 71607
language R version.string R version
3.3.2 (2016-10-31) nickname Sincere Pumpkin Patch
After reading RWeka Odds and Ends I realized, that my WEKA_HOME was set to a path in my profile and that the Weka package manager (WPM) seemed to have problems with saving the necessary modules. The solution was to set the path to my hard drive and refresh the cache.
Sys.getenv("WEKA_HOME") # where does it point to? Maybe some obscure path?
# if yes, correct the variable:
Sys.setenv(WEKA_HOME="C:\\MY\\PATH\\WEKA_WPM")
library(RWeka)
WPM("list-packages", "installed")
Afterwards, everything got back to normal and M5P worked like before.

Unable to install Java Runtime (6) on Mac

I'm having a problem of installing java SE runtime 6 on mac, without that, I can't open my eclipse or install Intellij. However, I download the .dmg through an Apple - Java link, but it just doesn't install!
And there's no error message, just the page of falling installation.
I really don't know how to solve it.
This is kind of an update of my problem... I used to have Java SE runtime 6 and tried to install jdk 1.8 and failed. Same picture appeared. Just said failed installing with no error messages. I guessed might be a conflicts? and deleted Java 6 and basically can't run eclipse & Intellij (this solved thought) I still have java 1.7 here.
I just can't figure out why I can't install (or reinstall) java 1.6 or java 1.8. What could be the problem?
Some system updates:
if I do: "which java":
/usr/bin/java
if "echo $JAVA_HOME":
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
if java -version:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
What could be possibly wrong?!!!????
God
You need to get Java directly from Oracle (http://www.oracle.com/technetwork/java/javase/downloads/index.html) as Apple stopped supporting Java some time ago. Unless you have pressing reasons for using Java 6 I suggest also installing at least Java 7, although you can have all three versions installed and select the appropriate version for the app you want to run/develop.
Edit Also, if you want to use Eclipse or IntelliJ (go for IntelliJ) you want to get the JDK and not the "runtime" (JRE).

I am getting a "Bad version number in .class file" after my .jar file has already executed?

I have an odd one for you. I have a simple .jar installer program that I wrote in Eclipse on my MacBook Pro, running OS X 10.6.8. When I run the program in Windows 7, Vista and XP; works like a dream. However, when I try and run it in OS X 10.6.8, the program will execute like it should, however when it completes its execution I get the "Bad version number in .class file" error message.
I ran "java -version" from the terminal and got
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
I also confirmed that Eclipse's compiler is using Java 1.6 for everything. As I have scoured the forums it looks like this error prevents the running of the program; but I have yet to see anything about the error showing up after the program has already run.
Bad version number in .class file means the program was compiled in a newer version of JDK and you are attempting to run it in an older version of JVM.
E.G. you compiled using java 5.0 and are attempting to run using java 1.2.
Do you have some dependencies in the project? Like external .jar files (either as separate .jars or classes repacked to your jar)? They could be compiled with newer version of java (1.7 maybe?) or a bit newer version of 1.6 (on Windows there is 1.6.26 now - Mac version usually lags a bit).

Categories

Resources