Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JCEf not launching on MAC in eclipse

Anu Chawla
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 30, 2018

I have built jcef for MAC with following versions
MAC 10.13.4
Xcode 9.3
java 1.8.0_171 and 1.8.0_191 both tried
JCEF built from instructions https://bitbucket.org/chromiumembedded/java-cef/wiki/BranchesAndBuilding
Eclipse IDE for Java Developers Luna Service Release 1 (4.4.1)
I created an eclipse project and imported all the jars, copied Release folder in the project, then I am trying to run following MainFrame.java example

package jcefdemo;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JTextField;

import org.cef.CefApp;
import org.cef.CefApp.CefAppState;
import org.cef.CefClient;
import org.cef.CefSettings;
import org.cef.OS;
import org.cef.browser.CefBrowser;
import org.cef.handler.CefAppHandlerAdapter;

import java.lang.reflect.Field;


public class MainFrame extends JFrame {
private static final long serialVersionUID = -5570653778104813836L;
private final JTextField address_;
private final CefApp cefApp_;
private final CefClient client_;
private final CefBrowser browser_;
private final Component browerUI_;


private MainFrame(String startURL, boolean useOSR, boolean isTransparent) {
CefApp.addAppHandler(new CefAppHandlerAdapter(null) {
@Override
public void stateHasChanged(org.cef.CefApp.CefAppState state) {
if (state == CefAppState.TERMINATED) System.exit(0);
}
});
CefSettings settings = new CefSettings();
settings.windowless_rendering_enabled = useOSR;
cefApp_ = CefApp.getInstance(settings);
client_ = cefApp_.createClient();
browser_ = client_.createBrowser(startURL, useOSR, isTransparent);
browerUI_ = browser_.getUIComponent();


address_ = new JTextField(startURL, 100);
address_.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
browser_.loadURL(address_.getText());
}
});

getContentPane().add(address_, BorderLayout.NORTH);
getContentPane().add(browerUI_, BorderLayout.CENTER);
pack();
setSize(800, 600);
setVisible(true);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
CefApp.getInstance().dispose();
dispose();
}
});
}

public static void main(String[] args) {
// Perform startup initialization on platforms that require it.
try {
String libpath = "<path to project>/jcefdemo/Release";
System.setProperty("java.library.path",libpath);
final Field sysPathsField = ClassLoader.class.getDeclaredField("sys_paths");
sysPathsField.setAccessible(true);
sysPathsField.set(null, null);

if (!CefApp.startup()) {
System.out.println("Startup initialization failed!");
return;
}
boolean useOsr = false;
new MainFrame("http://www.google.com", true, true);
System.out.println("Startup ");

} catch (Exception e) {
e.printStackTrace();
}
}
}

 

**but getting below error**

java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1349)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1324)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1348)
at org.cef.CefApp.<init>(CefApp.java:164)
at org.cef.CefApp.getInstance(CefApp.java:215)
at org.cef.CefApp.getInstance(CefApp.java:193)
at jcefdemo.JCefBrowser.<init>(JCefBrowser.java:34)
at jcefdemo.JCefBrowser.main(JCefBrowser.java:57)
Caused by: java.lang.UnsatisfiedLinkError: org.cef.CefApp.N_PreInitialize()Z
at org.cef.CefApp.N_PreInitialize(Native Method)
at org.cef.CefApp.access$0(CefApp.java:548)
at org.cef.CefApp$1.run(CefApp.java:157)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
initialize on Thread[AWT-EventQueue-0,6,main] with library path /Users/admin/Documents/test/jcefdemo/Release

java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1349)
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1324)
at javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1348)
at org.cef.CefApp.initialize(CefApp.java:418)
at org.cef.CefApp.createClient(CefApp.java:309)
at jcefdemo.JCefBrowser.<init>(JCefBrowser.java:35)
at jcefdemo.JCefBrowser.main(JCefBrowser.java:57)
Caused by: java.lang.UnsatisfiedLinkError: org.cef.CefApp.N_Initialize(Ljava/lang/String;Lorg/cef/handler/CefAppHandler;Lorg/cef/CefSettings;)Z
at org.cef.CefApp.N_Initialize(Native Method)
at org.cef.CefApp.access$5(CefApp.java:549)
at org.cef.CefApp$3.run(CefApp.java:411)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
java.lang.UnsatisfiedLinkError: org.cef.handler.CefClientHandler.N_CefClientHandler_CTOR()V
at org.cef.handler.CefClientHandler.N_CefClientHandler_CTOR(Native Method)
at org.cef.handler.CefClientHandler.<init>(CefClientHandler.java:39)
at org.cef.CefClient.<init>(CefClient.java:90)
at org.cef.CefApp.createClient(CefApp.java:314)
at jcefdemo.JCefBrowser.<init>(JCefBrowser.java:35)
at jcefdemo.JCefBrowser.main(JCefBrowser.java:57)

 

 

 

 

 

1 answer

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 3, 2018

Hi Anu!

I believe your issue is not with Bitbucket or with any other Atlassian product, but with some code you found in Bitbucket, is this correct?

If so, I'm afraid we won't be able to help you, you'll need to reach out to the author of the code itself. 

If the issue is related to our tool, please specify more in detail what problem are you facing so we can continue helping you.

Best regards,

Ana

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events