B4J Question ClassNotFoundException

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi

I try my first b4j program but i always get a message as attached image file.
this message tell me it couldn't found my controller "jinyistudio.controller".
My form just have one botton inside.

B4X:
#Region  Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 400
#End Region

#AdditionalJar:j2mod-1.06

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private button1 As Button
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.SetFormStyle("UNIFIED")
    MainForm.RootPane.LoadLayout("test1") 'Load the layout file.
    MainForm.Show   
End Sub


Sub button1_Action
   
End Sub
 

Attachments

  • b4j_QA1.png
    b4j_QA1.png
    7.5 KB · Views: 265

Roycefer

Well-Known Member
Licensed User
Longtime User
Is that class that can't be found in your j2mod-1.06.jar file? I think you should post the full stack trace so we can see in which subs the error occurred.
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
B4X:
Program started.
Error occurred on line: 16 (main).
javafx.fxml.LoadException:
file:/D:/jylab/project/b4j/tempjars/AsyncInput1!/Files/test1.fxml:13
    at javafx.fxml.FXMLLoader.constructLoadException(Unknown Source)
    at javafx.fxml.FXMLLoader.access$700(Unknown Source)
    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(Unknown Source)
    at javafx.fxml.FXMLLoader$RootElement.processAttribute(Unknown Source)
    at javafx.fxml.FXMLLoader$Element.processStartElement(Unknown Source)
    at javafx.fxml.FXMLLoader$ValueElement.processStartElement(Unknown Source)
    at javafx.fxml.FXMLLoader.processStartElement(Unknown Source)
    at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
    at javafx.fxml.FXMLLoader.load(Unknown Source)
    at anywheresoftware.b4j.objects.FXMLBuilder.LoadLayout(FXMLBuilder.java:115)
    at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:71)
    at b4j.example.main._appstart(main.java:71)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.
reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:563)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:224)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at b4j.example.main.start(main.java:36)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$176(Unknown Source)
    at com.sun.javafx.application.PlatformImpl.lambda$null$174(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(Unknown Source)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$149(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: jinyistudio.controller
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 34 more
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Test1.fxml as following

B4X:
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.canvas.*?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.collections.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.web.*?>

<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="480.0" prefWidth="640.0" type="AnchorPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="tw.jinyistudio.controller1" />
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
It is ok when i use internal designer to create layout. Why ?
 
Upvote 0

jinyistudio

Well-Known Member
Licensed User
Longtime User
Hi
j2mod is a modbus library. I have remove it,the result is not ok(same) too.
 
Upvote 0
Top