Why Terminal Not Returning Results To IDE

May 14, 2014

i am trying to run a command in terminal the code is below if i run the command in terminal it works fine however when i run it from netbeans with code below nothing gets printed. however if i run a different command such as (ip addr) it works fine?

public static void a() throws IOException{
ArrayList lister=new ArrayList();
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("ps -ef | grep firefox");// the command i am trying to run to get pid of application
InputStream stderr = proc.getInputStream();

[Code] ....

View Replies


ADVERTISEMENT

Exam Results - Code Should Split Results In Stars In 4 Categories

Nov 30, 2014

I'm doing a program where a user enters in exam results for students. Once he's entered the code, the code should split the results in stars in 4 categories.

I am working with a while loop that prints out infinite results. What I want to do is, if the user enters 2 digits, say "12", it should output 1 "*".

If the user enters "21" and "22", it should output "**".

There are 4 categories of marks which are marked with ints range1, range2, range3 and range4, which are user enter digits. Part 1 of the code is to split the user entered digits into its correct ranges. the ranges are 0-29, 30-39, 40-69 and 70-100. I've done the part where when the user enters a digit, it goes into the correct variable. After that when the user enters a digit over 100, the enter results should show up as stars. For example

Enter number =

21
22
44
66
44
23
11
111 (the 111 is where the program breaks and moves on)

So it should then display

0-29 ****

30-39

40-69 ***

70-100

Whatever I'm trying, it displays an infinite amount of stars. If I try to use break, It only outputs a single star, no matter how many digits I enter

Here is the code

int mark = 0;
int range1 = 0, range2 = 0, range3 = 0, range4 = 0;
int count1 = 0, count2 = 0, count3 = 0, count4 = 0;
while (mark >=0 && mark <=100) {

[Code] .....

"The problem is with the while loop, the one above is something I was experimenting with "

View Replies View Related

Terminal Within Java GUI?

Sep 19, 2014

I have developed a Java GUI by using Netbean. The user interface will get the user parameters that are needed by a c++ program (which I also developed). Upon clicking the run button java will execute the c++ program with the inserted parameters by launching and X-term session (using Runtime.getRuntime().exec(command) ) . Everything works fine in this way. However I do not find very elegant to launch an external terminal to run the C++ code. Is it possibile to have a terminal that is integrated within the java GUI? And run the C++ code within it?

Moreover, since the C++ code may take several hours to finish the job is there a way to read its output and use it in order to make, for example, proceed a progress bar?

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

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

Using Text Edit On Mac And Using Terminal To Execute Java Code

Aug 7, 2014

So when writing my first "Hello World" app everything seemed to work just fine. I wrote the code, compiled it, and then ran the class file and it worked, I got the return Hello World! But when I tried to write another app which is basically the exact same thing just a different sentence, I keep getting a bunch of error codes saying illegal character. I did everything the exact same. I am using Text Edit on a Mac and using Terminal to execute the Java code.

Here is what I wrote....

public class MyFirstApp
{
public static void main( String[] args )
{
System.out.println(“i rule the world!”);

[code]...

View Replies View Related

Applet Open But Stay Blank And Error Message Appear In Terminal

Jul 29, 2014

What's wrong with my Java program? When I open it using appletviewer, the applet opens but stays blank and an error message appears in Terminal.

Java Code:

import java.applet.*;
import java.awt.*;
public class DemoColor extends Applet
{
Font littleFont = new Font("Helvetica", Font.ITALIC, 6);
public void paint(Graphics gr)

[Code] ....

Error Message:

Exception in thread "AWT-EventQueue-1" java.lang.IllegalArgumentException: Color parameter outside of expected range: Red Green Blue

at java.awt.Color.testColorValueRange(Color.java:310)
at java.awt.Color.<init>(Color.java:395)
at java.awt.Color.<init>(Color.java:369)
at DemoColor.paint(DemoColor.java:24)

[Code] ....

HTML file:

<HTML>
<APPLET CODE="DemoColor.class" WIDTH = 420 HEIGHT = 300>
</APPLET>
</HTML>

View Replies View Related

ProcessBuilder No Results

Feb 23, 2014

try {
ProcessBuilder PB=new ProcessBuilder("find","/","-iname",""vim"");
PB.redirectOutput(Redirect.INHERIT);
PB.redirectError(Redirect.INHERIT);
PB.start();
}
catch (Exception e) {
e.printStackTrace();
}

It shows nothing. But when I tried

new ProcessBuilder("uname");

I gets a result ....

View Replies View Related

Printing Results From A Method

Apr 27, 2014

I need to print certain information from an arraylist depending on the arguments the method has. I'm trying to print the last 3 methods from the database class but nothing is printing and I don't know what the problem is.

package hw3;
import java.util.*;
public class Driver {
public static void main(String[] args){
/* Comments required
PersonFileReader pfr = new PersonFileReader("person.dat");
ArrayList<Person> testData = pfr.readData();
Database db = new Database(testData);
*/

[Code] .....

On the driver class I just print what the methods from the database class do.

View Replies View Related

JSF :: Jsf2 Search Results Not Displaying?

Apr 27, 2014

I develop a little app in javaee6 and jsf2. I have a search page which has a search form with 2 fields and a search button when i click search button the results should be displayed in searchresults page.

Here is my code,

search.xhtml page
<h:form id="searchform">
<h:inputText id="deptId" value="#{searchBean.departmentId}"></h:inputText>
<h:inputText id="deptName" value="#{searchBean.deparmentName}"></h:inputText>
<h:commandButton value="Click to Search" action="#{searchBean.searchEmployees}">

[code]...

Issue: searchresults page is is not displaying records though it fetched records from table I'm able to achieve this using search bean as session scope but i want to use the scope as Requestscope.

View Replies View Related

Swing/AWT/SWT :: Displaying Results In A Message Box?

May 8, 2014

how to display results in a PLAIN_MESSAGE. My program is converting hex to decimal and displaying the results. Here's the code:

package pkgfinal;
import javax.swing.JOptionPane;
import java.util.Scanner;
public class Final {
public static int Convert(String userInput, int base){
int running_sum = 0;

[code].....

View Replies View Related

Swing/AWT/SWT :: Using SetText To Display GUI Results

Feb 15, 2015

I have the code here to populate a GUI. I have the math and then print out and return a single number. I have tried to use setText in the class CalculateButtonHandler.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class RectangleProgram extends JFrame {
private JLabel lengthL, widthL, areaL, perimeterL, averageL;

[Code] ....

View Replies View Related

Stream To Collection - Saving Results

Mar 25, 2014

I have the following

Java Code: list.stream().sorted((s, s1) -> s.getName().compareTo(s1.getName())).distinct(); mh_sh_highlight_all('java');

I want to save the results to a collection.

I saw an video tutorial on these by Oracle learning library and they mentioned an into(collection) method but I looked at the api and there isn't one.

How can I do it?

View Replies View Related

Odd Results From Octal-decimal Converter

Mar 13, 2015

I wrote this small program to take an octal number from the user and convert it to decimal form.

import java.util.Scanner;
public class Decimal
{
public static void main (String args []) //gets octal number from user, later prints conversion
{
int octal;

[Code] .....

Some conversions work. For example, 77 will be correctly converted to 63, and 77777777 will be converted to 16777215. However, some conversions do not work. An example of this is 775002 gets converted to 74898.

View Replies View Related

How To Just Copy A Link To Results Page

Dec 17, 2014

I'm working on a simple site for my friend, and he asked me to link to his other site. I need to have the link to a specific search. For example, if I search for "Heathrow," I need to be able to link a button on the other site so that it can be clicked and directed to the search results on this page. Problem is that this is apparently all Java (which I know nothing of) and how to just copy a link to the results page.

View Replies View Related

Not Getting Correct Results In Binary Search Tree

Aug 17, 2014

I don't see any nodes that I add. Not sure why getting this error.

duplicate found
Exception in thread "main" java.lang.NullPointerException
at binarysearchtree.delete(binarysearchtree.java:111)
at binarysearchtree.main(binarysearchtree.java:196)
Java Result: 1
public class node<T>

[Code] .....

View Replies View Related

Program To Add 2 Roman Numerals Together And Return The Results

Feb 26, 2014

Writing an program to add any 2 given Roman numerals together and return the results.

[I don't want to convert Roman numbers to decimal numbers & then add together, then convert in to Roman numerials ]

Is there any direct way to add roman numerials?

For example: I + I = II
III + I = IV

View Replies View Related

Java Program For Retrieving Results From LDAP

Jan 23, 2014

I'm trying to run the following java program by using the instructions provided here URL....The program tries to connect to LDAP directory, searches for an objectGUID and returns sAMAccountName...But when I compile the java program I get 19 errors as given below.

/a1/utils/seek.java:2: cannot find symbol
symbol : class string
location : class seek
public static void main (string[] args) {

[code]....

View Replies View Related

Trying To Display Array Results In GUI Window JAVA

Sep 16, 2014

I am having the hardest time trying to figure out how to display an array in a 1-window GUI.

I can display 1 book separately, by basically ignoring the array and creating a new object for each book, but I need all 5 books to display in one window, and that's where I'm lost. I'd really like to use the arrayI built to generate the books in the GUI. The information of each book appearing horizontally, and the different books appearing vertically.

// Bookstore.java
// This program displays information on multiple books

/* Currency Formating Import */
import java.text.NumberFormat;
import java.util.Locale;
import java.util.Arrays;

[Code] ....

View Replies View Related

Count Results By Transforming Numbers Into Symbols?

Oct 23, 2014

i am trying to turn an int number etc. 6 into 6 symbols the result would be "------". how can i transform int=6 into "------"? what function do i have to use to do this count?

public class Diagram {
public static void skrivDiagram() {
Random rand = new Random();
int[] frequency = new int[13]; {

for (int roll = 1; roll <= 100; roll++)

[code]....

Here i want to transform the frequency[face] into "-".

View Replies View Related

How To Print Results Of Method To A File Using PrintWriter

Apr 29, 2015

private static void getTablas(int num) {
//ciclos anidados
System.out.print("x");
//linea horizontal
for (int i = 1; i <= num; i++) {
System.out.printf("%3d ",i);

[Code] .....

View Replies View Related

3D Graphics - Inaccurate Results Using GluLookAt (LWJGL)

Jun 16, 2014

I've recently started programming with lwjgl, playing around with some 3D graphics. I've built a house and now I'm trying to render a view looking straight onto the center of the roof, but with current configuration it's slightly off.

As you can see in the image the edges on the roof aren't perfetly straight which would be the case if I was looking straight to the center from a point on the roof normal vector. I'm using gluLookAt to get the view, using the following code:

gluLookAt(house.getRoofCenter().x + house.getRoofNormal().x * 0.25f,
house.getRoofCenter().y + house.getRoofNormal().y * 0.25f,
house.getRoofCenter().z + house.getRoofNormal().z * 0.25f,
house.getRoofCenter().x, house.getRoofCenter().y, house.getRoofCenter().z, 0.0f, 1.0f, 0.0f);

And for the normals:

Vector3f.sub(p2, p1, a);
Vector3f.sub(p3, p1, B)/>/>/>;
Vector3f.cross(a, b, c);
roofNormal = new Vector3f(-c.x, -c.y, -c.z);

and center:

roofCenter = new Vector3f((p3.x + p1.x) / 2, (p3.y + p1.y) / 2, (p3.z + p1.z) / 2);

My question is: Is this due to errors in the rendering methods or is my math off?

View Replies View Related

JSP :: Dynamic Table - Call List To Show The Results

May 7, 2014

Well, I have a list inside of a java class then i want to call that list into the jsp to show the results. That list has results from a query, everything is ok in java class because it shows me just one result in jsp, i read that it can be do with a for or enhanced for but been honest i have try everything and nothing work.

To import the class i did this.

<%@ page import="servlet.promotion*" %>

And the For.

<% for (int i=0 ; promos.size() < i;i++) { %>
<tbody>
<td><input type="text" name="C1" value="<%=m1%>"readonly = "readonly"> </td>
.... .... ....
</tbody>
<% } %>

The list is called promos.

View Replies View Related

Servlets :: Make Array From DB Results To Send To JSP Page?

Jun 25, 2014

I can now call the DB on the query I want and return results. What I know want to do is build an array of the data, forward it to the JSP page and display the bits individually.

So THis is the Servlet I havce:

package com.journaldev.jdbc.datasource;
import java.awt.List;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;

[code]...

I think It is to do either with the way I am adding the values to User or its the forward:

getServletConfig().getServletContext().getRequestDispatcher("/test.jsp").forward(request, response);

View Replies View Related

How To Save Results / Inputs For A Binary Search Algorithm

Apr 24, 2014

Is there a way that I can save a binary search algorithm to a text file or something, so that it will always contain more information? The reason why I ask this is because I have BST like project which is supposed to act the game Twenty Questions, were it asks a person 20 Q's until it guess the answer. However, although my project does not require you to save stuff to a file, I find it rather very useful and cool if I could do that.So for example it would start out something like this:

Think of an animal and I will guess it.
Does it have legs? YES
Is it a cat? YES
I win! Continue? YES

Think of an animal and I will guess it.
Does it have legs? NO
Is it a snake? YES
I win! Continue? YES

Think of an animal and I will guess it.
Does it have legs? NO
Is it a snake? NO
I give up. What is it? EARTHWORM
Please type a question whose answer is yes for an earthworm and no for a snake.
DOES IT LIVE UNDERGROUND?
Continue? YES

Think of an animal and I will guess it.
Does it have legs? NO
Does it live underground? NO
Is it a snake? NO
I give up. What is it? FISH
Please type a question whose answer is yes for an earthworm and no for a snake.
DOES IT LIVE IN WATER?
Continue? NO
Good-bye.

However, if the user exits the program then everything will be lost and go to waste. So once again, is there a way that I can save all of these inputs to a file or something and then read it in again?

View Replies View Related

Code Won't Output Rock Paper Scissor Results

Nov 7, 2014

When I try running the program it wont output the determineWinner method, I think there is something wrong with the way i called results. But I am not exactly sure?

public class rpsGame
{
public static void main( String [] args ) {
String userName = getUserName();
String playerChoice, computerChoice;
computerChoice = getComputerChoice();

[Code] ....

View Replies View Related







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