GeneralCore
GeneralCore
JCHJava Community | Help. Code. Learn.
Created by GeneralCore on 1/9/2025 in #java-help
"Java Virtual Machine Launcher -A Java Exception has occured" error in Maven .jar file
When I use "java -jar [file name].jar" using cmd it works, but doucle cliking the .jar file give me an error. I use maven assembly plugin, and netbeans > build with dependencies
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.mycompany.ytdlp.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.mycompany.ytdlp.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
11 replies
JCHJava Community | Help. Code. Learn.
Created by GeneralCore on 7/2/2024 in #java-help
Operation not allowed for a result set of type ResultSet.TYPE_FORWARD_ONLY.
public reading() {
ResultSet rs;
try {
Statement st;
String sql = "SELECT * from utility";
st = con.createStatement();
rs = st.executeQuery(sql);

rs.last();
System.out.println(rs.getInt("reading"));

} catch (Exception e) {
System.err.println(e);
}
}
public reading() {
ResultSet rs;
try {
Statement st;
String sql = "SELECT * from utility";
st = con.createStatement();
rs = st.executeQuery(sql);

rs.last();
System.out.println(rs.getInt("reading"));

} catch (Exception e) {
System.err.println(e);
}
}
rs.last() is the cause of the problem. I have no problem when I use
rs.next()
rs.next()
. But the thing is, I only need to retrieve the last row of the reading column instead of retrieving everything. I also tried putting
rs.last()
rs.last()
in
if-else
if-else
5 replies