Sending value from java netbeans to arduino and getting result back to java

/* this is my java code to send value to arduino and receiving value from arduino,
can any one tell what i have made mistake, i am able to send the value but can't received value from aruino(print value*/

package hell;

import com.panamahitek.ArduinoException;
import com.panamahitek.PanamaHitek_Arduino;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.SerialPortEvent;
import gnu.io.SerialPortEventListener;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Enumeration;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*

  • @author tenzin lobsang
    */
    public class led extends javax.swing.JFrame {
    PanamaHitek_Arduino Arduino = new PanamaHitek_Arduino();
    private BufferedReader input;
    SerialPort serialPort;
    public led(){
    initComponents();

try {
Arduino.arduinoTX("com3", 115200);
}
catch (ArduinoException ex) {
Logger.getLogger(led.class.getName()).log(Level.SEVERE, null, ex);
}

}
public synchronized void close() {
if (serialPort != null) {
serialPort.removeEventListener();
serialPort.close();
}
}
public synchronized void serialEvent(SerialPortEvent oEvent) {System.out.println("lol 31");
if (oEvent.getEventType() == SerialPortEvent.DATA_AVAILABLE) {
try {System.out.println("lol 1.1");
Scanner s = new Scanner(serialPort.getInputStream());
int mes =Integer.parseInt( s.nextLine());
//String inputLine=input.readLine();
//System.out.println(inputLine);
System.out.println(mes);
System.out.println("lol 1");
} catch (Exception e) {
System.err.println(e.toString());
System.out.println("Syncronice ");

}
}
// Ignore all the other eventTypes, but you should consider the other ones.
}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

try{
Arduino.sendByte(0);
}
catch(Exception ex){
Logger.getLogger(led.class.getName()).log(Level.SEVERE,null, ex);
}
System.out.println("led is off");
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

try{
Arduino.sendByte(1);
}
catch(Exception ex){
Logger.getLogger(led.class.getName()).log(Level.SEVERE,null, ex);
}

System.out.println("led is on");
}

public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new led().setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
// End of variables declaration
}

/* here is my arduino code
which received value from java and print value accordingly */

int val = 0;
int led = 8;

void setup()
{
Serial.begin(112500);
pinMode(led, OUTPUT);
}
void loop()
{
//delay(100);
if (Serial.available()>0)
{
val = Serial.parseInt();
if(val == 1) //Switch on the LED, if the received value is 1.
{
digitalWrite(led, HIGH);
Serial.println("Succesfully received.");
}
else if(val == 0) //Switch off the LED, if the received value is 1.
{
digitalWrite(led, LOW);
}
}

}

/* thank you for your time
from tenzin*/

Does the Arduino program work properly with the Arduino Serial Monitor?

I suspect if does and if so, that means the problem is in your Java program and a Java programming forum would probably be a better place to get advice.

...R