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


ADVERTISEMENT

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

Unable To Compile Codes Using Command Prompt

Feb 9, 2014

I have installed java and I am not able to compile codes using command prompt.... what are the correct settings so that I can proceed further ....

Capture.JPGCapture2.JPG

View Replies View Related

Unable To Get GPA Of Student As Command Line Argument

Feb 15, 2015

I'm writing a Java program to get the gpa of a student as a command line argument. Then display the class of the degree according to some criteria. Here is my code. But it says "ArrayIndexOutOfBoundsException :0". How can I fix this?

public class Stgpa
{
public static void main(String[] args)
{
double gpa= Double.parseDouble(args[0]);
if(gpa>=3.6)
System.out.println("Class of the degree is: First Class Hons");
else if(3.6>gpa && gpa>=3.4)

[Code]...

View Replies View Related

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

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 View Related

Unable To Compile One Of Selenium WebDriver Files To Run From The Command Line

Apr 24, 2015

I'm trying to compile one of my Selenium WebDriver .java files to run from the command line. Since it's just one file, I only need to compile the file into a .class file to run it from the cmd line. I don't need to make a .jar file.

The .java file runs fine inside Eclipse, so now I need to make it run from the windows command line.

I tried compiling it using

javac -classpath C:WDJarFilesselenium-server-standalone-2.42.2.jar TasksCreateAssignments.java

but got this error

TasksCreateAssignments.java:23: error: package org.apache.poi.hssf.usermodel does not exist

how can I can fix that?

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

Why Command Prompt Does Not Recognize Java As A Command

Jul 22, 2014

I am trying to execute a program from the command prompt. I type java -jar zuul.jar (zuul is the name of my project) and I get a message that java is not recognized as an internal or external command. What do I do wrong?

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

Run Bash Command From JAVA On MAC

Nov 17, 2014

import java.io.File;
import java.io.IOException;
public class ReadAllFilesinFolders {
public static File folder = new File("/Users/path/Documents/test");
public static void main(String[] args) {

[Code] ....

View Replies View Related

How To Run Telnet Command In Java

Jul 30, 2014

How to run Telnet Command in java?

View Replies View Related

Java And Command Line Interaction

Aug 7, 2014

I am trying to interact with the command line prompt and script the responses for some config. When asked if user wishes to continue I would like respond yes or no, however I would like this response to be automated without any user interaction. I am able to launch the .exe file however when the command prompt is launched I cannot get any further responses to it.

p Java Code: ublic static void runConfigure(String[] refBox1,String outDir2)
throws IOException{
String s = null;
try {

[code]....

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

Execute Shell Command From Java

Nov 15, 2014

I need executing shell script from Java program. For example i have start.sh script in /tmp/start.sh  folder of unix server. I want to execute shell script from local java code.

View Replies View Related

How To Send Command To Command Line

Jun 19, 2014

I simply cannot understand and find how to send a command to Command Line from Java.OK I can Open DOS:

1. Process p=Runtime.getRuntime().exec("cmd /c start");

2. Now How to "cd C:" + Enter ?

3. send another command "mvn clean install" + Enter

View Replies View Related

Java Program Is Failing To Run In Command Prompt?

Jan 23, 2014

My Java program is failing to run in command prompt and no result is produced.I am currently using windows 8 and I have changed my Environmental variable to C:Windowssystem32;C:Program filesJavajdkin.

View Replies View Related

Wrong Version Appearing For Java Command

Sep 8, 2011

I am a novice to coding and very new to Java. It appears that I am having a similar problem as the user above "Scott Allen". With a few exceptions. My issue is that when I run the command "javac" from the command prompt I am receiving the same error:- "javac is not recognized as an internal or external command, operable program or batch file"

After reading the comments from above I have configured my System Variables "Path" and "JAVA_HOME" to match the following:
JAVA_HOME: C:Program FilesJavajdk1.6.0_21in
Path: %JAVA_HOME%in; [First Variable]

There is no "Path" User variable on my computer, although there is a "TEMP" and "TMP" in the User Environment variables.

Currently I have the following Java related software installed:
- C:Program FilesJavajre6
- C:Program FilesJavajdk1.6.0_21
- C:Program FilesSunJavaDB
- C:Program FilesEclipse-jee-galileo-3.5.2

I have confirmed the "javac.exe" is located within the in directory of Javajdk.1.6.0_21..When I send "Java -version" to the command prompt the following is returned: java version "1.6.0_26"..Immediately I noticed that the version is wrong, but don't know why or what to do. Below is the output from the command "Java" using the command prompt.

Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:

-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

[code]....

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

Using Printf Command - Java Automatically Moving To Next Line

Aug 4, 2014

I'm learning about the printf command, and when I have it, it is not letting me ad an input. Here is my quick little program:

import java.util.Scanner;
public class TestingPrintF {
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);

[Code] ....

The first section works good, but when i move down to the second part it just automatically finishes without letting me enter a phrase.

View Replies View Related

Java App To Open A Console Base Program And Run A Command

Jan 13, 2015

I am struggling getting my java app to open a console window on either MacOS or windows and run a command. On windows I can get the cmd.exe program to open, but it won't execute the command. On MacOS, I cannot get it to even open the terminal.

String run = "c:
s34bil.exe
elap5.exe" + in + rst + out; //in, rst, out are parameters for the relpa5.exe file.
try {
Runtime rt = Runtime.getRuntime();
rt.exec(new String[]{"cmd.exe","/c",run,"start"});
} catch (IOException ex) {
Logger.getLogger(issrsUI.class.getName()).log(Level.SEVERE, null, ex);
}

View Replies View Related

Cannot Run Java Program That Is Using External Library From Command Line

Mar 30, 2015

I am reading the excellent book Algorithms. The author of this book is using his own libraries.

I have downloaded the libraries (it is a file called stdlib.jar) and I've store it in a directory called ~/Downloads(I am using a macbook pro).

Then I have created a project with IntelliJ Idea 14.1 using the default package (as it is the only way for a program to 'see' these libraries).

The program is running inside the ide, but because of the nature of this book, all the included code must be run from the command line.

The problem is that I cannot run for example the Average class from the command line because the system asks for the external library.

Specifically the error is :

I enter : java -cp . Average

and the Error I get is :

Exception in thread "main" java.lang.NoClassDefFoundError: StdIn
at Average.main(Average.java:11)
Caused by: java.lang.ClassNotFoundException: StdIn
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)

[Code] ....

The Average class is the following :

public class Average {
public static void main(String[] args) {
//Average the numbers on StdIn
double sum = 0.0;
int cnt = 0;

[Code] .....

View Replies View Related

Cannot Execute Java Code From Command Line In Notepad++

Jan 2, 2015

I have the program written correctly, but it won't execute.

public class Welcome {
public static void main(String[] args){
//Display message Welcome to Java! on the console
System.out.println("Welcome to Java");
}
}

I compiled the code as written below with "javac Welcome", and use the "Class" name "Welcome"

The file path is: C:Java Programs

Javac Welcome.java
Java Welcome

Below is the result of the above commands

javac Welcome

Create Process() failed with error code 2:

The system cannot find the file specified.

java Welcome

Process started >>>

Error: Could not find or load main class Welcome

<<< Process finished. (Exit code 1)

I am coding in notepad++

View Replies View Related







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