Running Java App With SQLite On Ubuntu

Nov 12, 2014

I have built a Java app that uses SQLite (sqlite-jdbc-3.8.7.jar). Running the jar file on windows works as expected however, trying to run it on Ubuntu Server 14.04 has turned into quite a task!

I put together a brand new machine in VirtualBox for testing. I installed Java (sudo apt-get install default-jre) and have installed SQLite (sudo apt-get install cl-sql-sqlite3 sqlitebrowser). I created a new sub-directory within my home directory and copied over the jar file. From terminal, I then run the command: sudo java -jar ProductionView.jar and I receive a java.lang.unsatisfiedlinkerror. For troubleshooting, within the app, before making a connection to the db, I have printed out the location of where the db is to be created and it is correct (see attached pic). Is there more that needs to be configured before I can run this app on Ubuntu? I have posted the relevant code below :

(AppDatabasePath() is what is printed in the image...).

public static String AppDatabasePath() {
return AppPath() + APP_NAME + ".db";
}
public static String AppDatabase() {
return "jdbc:sqlite:" + AppDatabasePath();

[Code] .....

View Replies


ADVERTISEMENT

How To Install Java 8 On Ubuntu 14.04

Apr 19, 2014

I used Ubuntu 13.10 on a Chromebook and Java7 and Java8 both worked nicely. Not on Ubuntu14.04, however.

I can try

sudo apt-get install openjdk-7-jdk
javac -version
java -version

… and it tells me 1.7.0_51 IcedTea etc. I haven't found an OpenJDK version of Java8, so I tried the usual technique of unzipping the Oracle download into /usr/java (which I have created and given “campbell” ownership of).

campbell@xxxxx:~$ /usr/java/jdk1.8.0_05/bin/java -version
bash: /usr/java/jdk1.8.0_05/bin/java: cannot execute binary file: Exec format error
campbell@xxxxx:~$ /usr/java/jdk1.7.0_55/bin/java -version
bash: /usr/java/jdk1.7.0_55/bin/java: No such file or directory

Same download in my home directory as I had last week. I repeated the download and got the same error. It is different from the error for Oracle Java7, which I haven't actually got installed at the moment.

I shall probably revert to Ubuntu13.10 for a bit.

View Replies View Related

Burning Java Application With Sqlite Database To CD

Jul 20, 2014

I have java application used to manage a sqlite database (add new records, search .....) I already have everything and I convert it to jar file but the question is how to burn it to cd with the sqlite database . I mean we need to change the database URL for connection class. My question is there any programs would combine my database + my jar file and make it exe file ?

or i should manually change my database url in connection class ? (if yes what should i write knowing that my database and my jar file will be burnt to a cd). I searched online but i could not found any one related sqlite database or at least a clear one . I already has my jar file but if i moved the database from its directory it will not work ...

View Replies View Related

Unable To Run Tshark Command In Java On Ubuntu

Sep 19, 2014

I am trying to run tshark command using runtime environment in java on ubuntu . My code is as follows :-

try {
String destip = map1.get((String) innObj.get("value"));
Runtime run = Runtime.getRuntime();
String tshk = "/usr/bin/tshark -r /home/pratibha/Desktop/vox.pcap -Y "ip.dst == "
+ destip
+ " && http" -T fields -e tcp.port -e col.Info";
Process pr = run.exec(tshk);

[code]....

map1 is hashmap which contains the destination ip adress.When i run the above code the exit code for process (pr) is 1 and hence the tshark command is not executing properly.

View Replies View Related

Compiling Multiple Java File Using Terminal In Ubuntu 12.04

Feb 11, 2015

I am new in java. I executed a java program using eclipse. the program contain two java file. when i try to run it using terminal in Ubuntu. Two files are not linking. it shows error. i am attaching all the data.

It shows the following error

regex2string.java:83: error: cannot find symbol
str = randomstr.nextString(2000);
^
symbol: variable randomstr
location: class regex2string
1 error

[Code] ...

View Replies View Related

Accessing File On Remote Ubuntu Machine Using Java

Mar 3, 2015

From java running on Windows, I need to access a file on a remote Ubuntu machine. I use the following:

URL U = new URL ( "http://" + SERVER_IP + ":" + SERVER_PORT + "/" + ClsName + ".class" );

where:

SERVER_IP is the Ubuntu IP address obtained from any site that shows the IP address of the machine you are using.SERVER_PORT is the Ubuntu port where the server is listening.

Now:

Do I need to modify this code any further?Do I need to configure the Windows and/or Ubuntu machine(s) for this to work? 

View Replies View Related

Error While Running In Command Prompt Only - In Eclipse Running Fine

May 19, 2014

This is my program: RemoteXMLRead.java

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.apache.commons.io.filefilter.WildcardFileFilte r;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import java.io.File;

[code]....

It is working fine when i run in Eclipse, but is giving error when i run in cmd.. What i need to do to over come this..

View Replies View Related

SQLite Database Path

Jan 19, 2015

I was asked to create an Android App with SQLite Database. I had referred some example and tutorial which can be found from the internet but 1 thing that is still unsolved.

The default path for Android SQLite is //data/data/<Your-Application-Package-Name>/databases/<your-database-name> which can be found in Eclipse DDMS after connecting the phone to the computer or the emulator is on.

I had tried many example and tutorial and yet I can only access to "data" file only and the rest (/data/<Your-Application-Package-Name>/databases/<your-database-name>)are never appeared on my screen. This is one of the website (URL....) I learnt to create my database app.

I had follow the steps exactly for many times but I still can't find the path. The app is running fine as it will show saved data/"contact" although I restart the apps(Which mean it did save my data but I just can't find where did it saved). What's wrong with my Eclipse?

View Replies View Related

API To Invoke Terminal In Ubuntu

Jun 5, 2014

I am trying to build and IDE for NASM in Java for Ubuntu. There are other IDE's for NASM but they are in C or C++. So i thought i should try making one in Java. Well I am done with the GUI part.

How should i link the NASM compiler to the IDE.
Or
There is another way like "DEV C++ IDE" does in Windows is that it invokes the CMD and runs it in that so i could try doing something like that by invoking the TERMINAL in Ubuntu and running it in that. Does java have an API for this purpose.

View Replies View Related

Dynamic Contents In SQLite Query And Error Because It Is Not Final

Aug 21, 2014

I'm trying to execute SQLite query like this:

final String gender = new String();
if (sexCombo.getValue().toString().equals("Man")) {
gender = "1";
}
else {
gender = "0";
}
final string Q = "INSERT INTO ... VALUES (...., " + gender + "...)");
stmt.executeUpdate(Q);

The problem is:

error: local variables referenced from a lambda expression must be final or effectively final stmt.executeUpdate(Q);

How can I generate query command using conditionals and make it work?

View Replies View Related

SQLite Not Writable - Attempt To Write To Only Read Database

May 29, 2014

I designed a Java desktop application (i.e the app runs on local computer), everything is fine until when I compiled the program and wanted to run it on another computer then it tell me "java.sql.SQLException: attempt to write to only read database".

View Replies View Related

Running Programs Through Java

Mar 30, 2014

I've been playing around with this for about an hour.

Java Code:

Runtime runTime = Runtime.getRuntime();
try {
Process process = runTime.exec("notepad");
} catch (IOException e) {
e.printStackTrace();
} mh_sh_highlight_all('java');
So that works. Notepad will open.

However, I'm trying to get other programs to open. Specifically, this program: C:Octave3.2.4_gcc-4.4.0inoctave-3.2.4.exe...However, using that in place of notepad doesn't work. I'm assuming that there is some sort of system variable that explains why simply typing "notepad" works? As if you type notepad into the run box, notepad will open. Soo does that snippet work by going through some sort of system variables?How would I go about opening other programs, such as the one I referenced above.

View Replies View Related

Insert A Record To A Table In Database - SQLITE Syntax Error

Jul 19, 2014

I am trying to insert a record to a table in my database . I used the same syntax for 2 tables, one does work and the other does not work . I could not find any explanation for this error

"INSERT INTO CustomerRecord (Name, Number, Adress)"
+" VALUES(?,?,?)"; //first table working well
ps.setString(1,r.getCustomerName());
ps.setString(2,r.getCustomerNumber());

[Code] ....

For some reason one does work but the other does not work it says syntax error near order (table name). I am using sqlite db ...

View Replies View Related

Unable To Run Tshark Command Using Runtime Environment On Ubuntu

Sep 19, 2014

I am trying to run tshark command using runtime environment in java on ubuntu . My code is as follows :-

try {
String destip = map1.get((String) innObj.get("value"));
Runtime run = Runtime.getRuntime();
String tshk = "/usr/bin/tshark -r /home/pratibha/Desktop/vox.pcap -Y "ip.dst == "
+ destip
+ " && http" -T fields -e tcp.port -e col.Info";
Process pr = run.exec(tshk);

[Code]...

map1 is hashmap which contains the destination ip adress When i run the above code the exit code for process (pr) is 1 and hence the tshark command is not executing properly.

View Replies View Related

Unable To Play Video In JPanel Using VLCJ In Ubuntu 13.04

Sep 15, 2014

I am trying to play video in JPanel using vlcj in ubuntu, there is no error. My project builts successfully. but do not plays video. when i run code JFrame comes for a while. when i use same code in windows. it plays video and works successfully, but not in ubuntu.

In output window , it show following

A fatal error has occured in java runtime environment. (and so many things.)

Following is my code : (i am using vlcj-3.0.1)

import com.sun.jna.NativeLibrary;
import java.awt.BorderLayout;
import java.io.File;
import javax.swing.JFrame;
import javax.swing.JPanel;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;

[Code] ...

Which path to give for vlc player in ubuntu. there are more than 5 folders with name vlc. one is in /usr/share/ and other is in /etc/ and so on.

View Replies View Related

Running Java File From Linux CMD

Apr 24, 2014

import acm.util.* ;
import acm.program.*;
import java.awt.* ;
class Chap6_ex1 extends ConsoleProgram {
public void run() {
println("This program displays a randomly schosen card.");
int number = rgen.nextInt(1 ,13);
int suit = rgen.nextInt(1 ,4);

[Code] ....

I am running the this from a Linux command line , in the cmd first i use :

javac -classpath acm.jar Chap6_ex1.java

end then :

java -cp .:acm.jar Chap6_ex1

The output i m getting after second command is :

Exception in thread "main" acm.util.ErrorException: Cannot determine the main class.
at acm.program.Program.main(Program.java:1358)

I know the problem is from the RandomGenerator class in packet acm.util.* but i dont know how to fix the problem . Every other program has worked . What I am missing or how this whole issue of packet importing works when running a java file from cmd ?

View Replies View Related

Running Java Program As Executable

Apr 16, 2015

I have tried to get my dinky little program I wrote to be stored as an executable through Eclipse to no avail. It seems I have tried everything else as well, to no avail. I do not want it to go through command prompt, but rather have it be its own entity. As you can probably tell my knowledge of Java and coding is limited, but always willing to expand.

View Replies View Related

Running Java At The Command Line?

Mar 27, 2014

I am just learning Java and I am have a problem running programs at the command line. I have the following code:

package java_help;
import java.io.IOException;
class help {

[Code].....

I can run this program in net beans were I originally wrote the program and it runs fine there. I also compile the program at the command line using javac but when I go to run this program I get a error message that it cant find main.

View Replies View Related

Running Java From Command Line

Mar 10, 2014

i have windows 7. cmd.exe told me it couldn't recognize javac.i have a JDK installed though...

View Replies View Related

Running Java Program Without Jdk Installed

Jan 25, 2014

I want to know is there any way to run java program without installing jdk.

I want to run my code on system which dnt have jdk installed on it. is it possible??

View Replies View Related

Running Java Programs From Command Prompt

Dec 17, 2011

My PC runs on Windows XP. When I try to run a java program (written using NetBeans) from the command prompt, the program opens in NotePad but does not run.This is what I have been typing at the command prompt:

C:javahellosrchelloHello.java

The above is the correct path to the Java file on my PC.how to run the program from the command prompt or perhaps link me to a tutorial that explains it?

View Replies View Related

EJB / EE :: Long Running Task Processing In Java

Feb 18, 2014

I want to develop a Java EE application for the following scenario.

Webapp takes a file from a user and analyze the file. This analysis could take hours. User should be able to check if the analysis is finished via AJAX. When the analysis is finished user should be able to view the analysis report that has been generated by the analyzer.

I checked what are the possibles ways I could achieve this but couldn't get a clear idea. I heard about JMS, Work Manager API and servlet asynchronous processing. But still not sure what to use and how to use.I'm not very much familiar with EJB.

View Replies View Related

Running C Compiled Executable File In Java

Jul 10, 2014

I'm trying to run a command line executable file using java but there is no output. On the task manager a conhost process opens when the application is run. I've tried

1)try {
Runtime.getRuntime().exec("D: est.exe");
} catch (Exception e) {
e.printStackTrace();
}

2)String[] cmd = { "D: est.exe"};
Process p = Runtime.getRuntime().exec(cmd);
p.waitFor();

and

3)//Runtime.getRuntime().exec("D: est.exe", null, new File("D:"));

same thing happens i.e. nothing happens.

View Replies View Related

Running Database Inside Java Application

Jul 1, 2014

I have to store data I've pulled from the web i wanted to do this by storing it in a database but after looking at some tutorials i'm not sure if its possible as the databases don't seem to run with the application but instead run as an independent entity.if its possible to have a database in the java application so it runs when the application runs.

View Replies View Related

Java Parallelization For OpenMPI Cluster Running

Dec 9, 2014

I need to parallelize my java application in order to run it in a cluster with many nodes where is OpenMPI.

My code works like this:

In the First.jar (the code below) runs a for loop many times which executes another jar file (Second.jar) with different argument in every loop.

Java Code:

for (int i = 0; i < gameEnd; i++) {
Runtime.getRuntime().exec("java -jar Second.jar "+plrA+" "+plrB+" "+path+");
} mh_sh_highlight_all('java');

View Replies View Related

OpenJDK Java Command Running Instead Of Oracle Version

Dec 1, 2014

I've Installed oracle JDK version 1.8 on a debian machine that already has openjdk 1.6.i've set the path variable in etc/login.defs and java_home variable In etc/environment. When I echo $JAVA_HOME it points to the oracle version correctly and when I run javac It uses the oracle 1.8 version. The problem is when I run the java command , It runs the openjdk 1.6 version and I'm not sure why.If I type java -version It shows the openjdk version.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved